Connect to Server via SSH with Git

Given: an Ubuntu server with central Git repository and connection via SSH and an Ubuntu client with local Git repository.

  • Deposit user’s SSH private key id_rsa in ~/.ssh (aka /home/user/.ssh)
  • chmod 0600 ~/.ssh/id_rsa to prevent other users reading user’s private key
  • If you also want to use Git with root user: cp /home/user/.ssh/id_rsa /root/.ssh/
  • Connect with git clone user@server:/path/to/git/<centralrepo>/ <localrepo>