I have a repo on my laptop and I want to push it to a remote repo on AWS EC2. This is how I build this. I upload my laptop repo on github. The repo on the EC2 was cloned from github. But I did a lot of config on the EC2 so I put some file in .gitignore
. I want to update some my new code on my laptop to EC2 so I want to push the code to repo on EC2 directly.
This is what I did to push:
I used MacOS, and I edit ~/.ssh/config
and add
Host Vidaminds_server
Hostname www.vidaminds.com
User ubuntu
IdentityFile ~/Downloads/Vidaminds.pem
And I used this command:
git remote add Vidaserver2 Vidaminds_server:~/Vidaminds/.git
git push Vidaserver2 master
It shows:
shen-3:New Platform shen$ git push -f Vidaserver2 master
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 507 bytes | 0 bytes/s, done.
Total 6 (delta 5), reused 0 (delta 0)
To Vidaminds_server:~/Vidaminds/.git
4cfe6da..7a6a4a8 master -> master
The dir on the EC2 is /home/Vidaminds/
and there is a .git
file in the folder. After I push it to EC2 my laptop shows it success but I didn't see my file change. I don't know if there is any error what I did.
Thanks!