There's likely some duplicates here on SO, but I didn't see them at first search, so here's your quick answer.
You probably want to use SSH public/private keypair authentication. In general, this means running ssh-keygen
on your local computer (if you haven't before), and then using ssh-copy-id user@host
to copy your public key to the remote. (If you don't have ssh-copy-id
, you can just add your public key to .ssh/authorized_keys
on the remote; that's all it does.) Be sure to give the public key to the appropriate user (the one with permissions for the git repo).
If you'd like to be more secure, you can give your keypair a passphrase and use something like ssh-agent or keychain to remember it for a session. See Configuring Git over SSH for more information on that.
If you're going to be doing a lot of this, you might want to look into gitolite, which automates a lot of this git admin type stuff. If you're going to keep doing it manually, and give others the ability to use that repo, you might want to make the repo user's shell git-shell
, which is essentially a no-login shell which is only able to run the necessary git commands.