How to push a local git repo directly to remote server

  1. 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
  2. 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/
  3. push to remote repo by running git push <remote name> <branch name>, for example: git push ec2 main
git linux
Buy Me A Coffee