How to push a local git repo directly to remote server
- create a bare repo on remote server
git init --bare
, as a best practice end the name of the directory with .git
in which you create the bare repo, for example: scraper.git
- add remote to the local git repo
git remote add <remote name> <ssh url for the bare repo>
, for example: git remote add ec2 ssh://ubuntu@ec2/home/ubuntu/sshfs/reddit-scraper/
- push to remote repo by running
git push <remote name> <branch name>
, for example: git push ec2 main
git linux