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! :)
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?
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
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.
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!
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
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.
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!
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.
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!
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
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
@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).
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.
That's really easy and simple. Thank you so much man!
Glad it helped Omar!
TAKE THIS LIKE, bro. Hours of my life spending on this problem are over
good work, my friend!
Nice work. This is exactly what I want.
Thank you so much. This is like magic for me.
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
Question. On the remote server do you have two git repos? One for the bare and one for the actual project?
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! :)
@@maximization yes! Got it 👌👌
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?
Yes, simply add two remotes with "git remote add [prod-client/prod-server]". Make sure the post-receive hooks deploy the respective folders
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
Хорошее видео, видел похожее от другого автора и это мне нравится гораздо больше! Хороший английский акцент
What a hell?? It should be pain, why is so easy? :D Thank you ;)
Very useful. Thanks.
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.
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!
This process is working for all the servers like 10n1,siteground etc.. or else only for aws and azure ?
Thank you maxim
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
This could be a permission issue or maybe insufficient disk space on the server
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.
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!
So clear.
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.
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!
when i try to give at git remote maximo@ip it says permission denied(public key)
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
Can I know what font you use in terminal?
Operator Mono
amaizing! so easy
Thank you !
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?
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
@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).
what about passwords for the server?
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.
Good job!
I’m sorry I couldn’t finish watching it