Managing Git Users and Passwords

I’ve been using Git to keep a repository of a project on a separate server. Currently to push things to the repository after a commit I do

git push

and then I am asked for the password for the account I used to setup the git repository on the remote server. Since it’s been awhile since I setup the repository, I’m not sure how to either remove that password (bad idea maybe) or change/add user accounts for the git repository. I’m sure it’s something simple but I’m having a hard time googling for it. Is there some argument I’m missing for the push command?

  • How can I set up the working directory and the local repository on different drives?
  • How to manage backups and monitor Git with a central repository?
  • Tips for using CVS or Subversion as a backup framework for office documents
  • How to restore Git after fatal file system error?
  • effects of initializing git repository on linux root directory 3:)
  • restore all refs from git bundle
  • Thanks.

  • Project layout with vagrant, docker and git
  • RStudio gives “Incorrect function” when setting git as Version control
  • How to log into git bitbucket repository from jenkins
  • How to merge two github accounts
  • Override git's choice of binary file to text
  • How to see whats changed between last commit and now(after making some changes)
  • One Solution collect form web for “Managing Git Users and Passwords”

    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.

    Git Baby is a git and github fan, let's start git clone.