Deploy to Your Server Using Git

Поделиться
HTML-код
  • Опубликовано: 8 янв 2025

Комментарии • 47

  • @omarelrayes8963
    @omarelrayes8963 3 года назад +4

    That's really easy and simple. Thank you so much man!

  • @BagsySigel
    @BagsySigel 2 года назад +1

    TAKE THIS LIKE, bro. Hours of my life spending on this problem are over

  • @pabloleiva9979
    @pabloleiva9979 2 года назад +1

    good work, my friend!

  • @bestyixuan
    @bestyixuan 3 года назад +1

    Nice work. This is exactly what I want.

  • @riyalmasla
    @riyalmasla 2 года назад

    Thank you so much. This is like magic for me.

  • @CodeChit_hindi
    @CodeChit_hindi 3 года назад

    When i'm pusing code. It's showing `You're on branch yet to be born` .... Although i can see in my terminal that it doest restart the pm2 server

  • @user-ui8my9zs7o
    @user-ui8my9zs7o Год назад +1

    Question. On the remote server do you have two git repos? One for the bare and one for the actual project?

    • @maximization
      @maximization  Год назад +1

      Nope, just the bare one which is configured as remote on your localhost. The folder where the project lives on your production server isn't a git repository, it only has the project code. Hope that makes sense! :)

    • @user-ui8my9zs7o
      @user-ui8my9zs7o Год назад

      @@maximization yes! Got it 👌👌

  • @CharcoalDaddyBBQ
    @CharcoalDaddyBBQ Год назад

    This is probably a silly question, but I have 2 main folders in my repo: client and server.
    'server' needs to deploy to one server.
    'client' to another.
    Is there a way to do that? Or should I split them into separate repositories?

    • @maximization
      @maximization  Год назад

      Yes, simply add two remotes with "git remote add [prod-client/prod-server]". Make sure the post-receive hooks deploy the respective folders

  • @9987366541
    @9987366541 3 года назад

    when i hit this "git push -u prod main"
    i get this error
    "Everything up-to-date
    Branch 'main' set up to track remote branch 'main' from 'prod'."
    Please help me

  • @Vorono4ka
    @Vorono4ka Год назад

    Хорошее видео, видел похожее от другого автора и это мне нравится гораздо больше! Хороший английский акцент

  • @alexlars
    @alexlars 4 года назад +1

    What a hell?? It should be pain, why is so easy? :D Thank you ;)

  • @mnrsociety5103
    @mnrsociety5103 4 года назад

    Very useful. Thanks.

  • @SkunkSCUL
    @SkunkSCUL Год назад

    I've been using your technique for a while, much appreciated! I'm having some trouble with it on one site - I'm getting an 18 killed error on post-receive. Any advice is much appreciated as I'm not having luck searching on my own.

    • @maximization
      @maximization  Год назад +1

      Glad you've found the technique helpful! As for the error message, without seeing the error it's hard to say. I'm assuming you're getting something along the lines of "line 18: killed". This might be an indication that the kernel/OS is terminating your process for some reason. A common reason for that is OOM (out of memory). Your application is using up a lot of memory and the OS is forced to terminate it. It could also be something entirely different. I would start by adding logs to the application on startup, at important execution steps and before terminating. Maybe even do a memory dump to see what's going on. I hope you get to the root of the issue, good luck!

  • @vamsikrishna2241
    @vamsikrishna2241 3 года назад

    This process is working for all the servers like 10n1,siteground etc.. or else only for aws and azure ?

  • @muftiwicaksono7914
    @muftiwicaksono7914 3 года назад

    Thank you maxim

  • @robotics1013
    @robotics1013 Год назад

    Can you please h3lp me, I am getting an error saying
    error: remote unpack failed: unable to create temporary object directory
    ! [remote rejected] main -> main (unpacker error)
    error: failed to push some refs to

    • @maximization
      @maximization  Год назад

      This could be a permission issue or maybe insufficient disk space on the server

  • @vividious
    @vividious 3 года назад

    When doing this tutorial, everything works. But when I push changes to the remote repo, it returns 'Everything up-to-date' and displays the received commit on the server when I run 'git remote -v', but the changes do not appear in the project directory. I've tried this tutorial as well as many other similar ones and have received the same results, I have no idea what I'm doing wrong.

    • @maximization
      @maximization  3 года назад +1

      Hi! That message suggests remote is up-to-date with local, meaning there are no changes/differences to push. You could run "git rev-parse HEAD" on both local and remote (same branch). If you get the same hash that explains the message. Commit new changes and try again. Otherwise you might be on a detached head on local, to fix that have a look at this StackOverflow answer stackoverflow.com/a/896956/4763270. Hope you solve the issue!

  • @asilbalaban
    @asilbalaban 2 года назад +1

    So clear.

  • @TravisHayler
    @TravisHayler 3 года назад

    I followed everything however when I run the first push I get remote: fatal: You are on a branch yet to be born and no files appear in the main project folder online.

    • @maximization
      @maximization  3 года назад

      That error means that git on your server is receiving files for a branch it doesn't yet know about. You can verify this by running "cat .git/HEAD" from the project folder on the server. If you see for example "ref: refs/heads/main" on your server, it means you're trying to push the "master" branch from your laptop and your server doesn't have it.
      To fix your issue, you can run "git symbolic-ref HEAD refs/heads/master" on your server from the project folder. This changes the current branch on the server to "master", which corresponds to the branch on your laptop. Alternatively, you can change your post-receive hook to always deploy the "master" branch: "git --work-tree=... --git-dir=... checkout -f master" (notice master at the end).
      For a more detailed explanation of the issue, check this StackOverflow answer stackoverflow.com/a/31150229/4763270. Hope that helps!

  • @vamsikrishna2241
    @vamsikrishna2241 3 года назад

    when i try to give at git remote maximo@ip it says permission denied(public key)

    • @maximization
      @maximization  3 года назад +1

      Hi vamsi,
      First of all make sure the user and IP of remote correspond with the user and IP of *your* server: @. Second, make sure your server's firewall isn't blocking incoming SSH connections (by default on port 22) and that it has your public key so it grants you access. Check out my other without about fixing permission denied error with Github, it might help you solve the issue with your server ruclips.net/video/ISeXMoEcG8Q/видео.html

  • @mnrsociety5103
    @mnrsociety5103 4 года назад

    Can I know what font you use in terminal?

  • @saharis811
    @saharis811 3 года назад

    amaizing! so easy

  • @andremazetto
    @andremazetto 3 года назад

    Thank you !

  • @gunrunjk
    @gunrunjk 3 года назад

    Thanks for your video, I am trying git remote add prod @:.git
    I got this:
    port 22: Connection refused
    Would you tell me what I am wrong?

    • @maximization
      @maximization  3 года назад

      Hi, the error means something is blocking the SSH connection between your machine and the remote server on the default port (22). It could be the server itself, your WIFI, your ISP, or anything in between.
      First, I'd make sure that the SSH service on your remote server is running on port 22. Run "sudo grep Port /etc/ssh/sshd_config". If you see a different port, you need to add the SSH port when you're adding the remote "git remote add prod @::.git". Also make sure the SSH service is up by running: "sudo service ssh status".
      Second, check that the firewall on your server isn't blocking incoming connections on the SSH port. You can use this tool canyouseeme.org/ to check if the SSH port is open.
      Hope you fix the issue,
      Maxim

    • @maximization
      @maximization  3 года назад

      @Funny Hi! From your error it seems git is not installed on the remote server. SSH into the server with user "administrator" and make sure git is installed and available to the command line. Confirm by running "git which" in the terminal should output the path to the git binary (e.g. /usr/bin/git).

  • @bn7228
    @bn7228 2 года назад +1

    what about passwords for the server?

    • @maximization
      @maximization  2 года назад +1

      Authenticating with the server happens through ssh keys. When you use git push, git uses your private SSH key (default location: .ssh/id_rsa) on your machine to authenticate with the remote server. The remote server has your public SSH key (default location: .ssh/id_rsa.pub) and therefore will allow you to git push. Nobody can deploy to your remote server unless they have your private SSH key.

  • @Deestylovmusic
    @Deestylovmusic 3 года назад

    Good job!

  • @musilicks
    @musilicks Год назад

    I’m sorry I couldn’t finish watching it