Alex Rivera | Logout

How do I store a password for my key so I can commit and pull from repository when using git on windows?

Asked 2010-09-02T08:21:28.283
20

Can someone point me in the direction I need look so I can configure my GIT client with the password needed for my private key? Every time I push and pull from my repository it asks me for the password for my key. I use command line and have the windows GIT client installed to use ssh.

Thanks for any pointers.

Edit
Report

1 Answer

20

Are you sure you’re cloning over SSH?

Run git remote -v. The output below is from a repository that clones via HTTPS: notice the https:// URL scheme.

origin  https://github.com/git/git.git (fetch)
origin  https://github.com/git/git.git (push)

Clone URLs for SSH will have one of two forms:

  • username@host.domain.tld:foo/bar/baz.git
  • ssh://username@host.domain.tld/foo/bar/baz.git

Assuming your host supports both SSH and HTTPS (as GitHub, GitLab, and Gitorious do), then simply change the remote’s URL rather than recloning the entire history.

git remote set-url origin git@host.domain.com:foo/bar/baz.git

Different hosts will have different URL designs. For example, switch the above GitHub URL from HTTPS to SSH with

git remote set-url git@github.com:git/git.git

GitHub has a related guide for changing a git remote’s URL.

Windows

On Windows, a typical setup uses PuTTY as the SSH client, which means you’ll want to run Pageant, PuTTY's SSH agent. On Windows, I run a quick batch job out of the Startup group:

@echo off
start /b "C:\Program Files\PuTTY\pageant.exe" "C:\Users\Greg\Greg.ppk"

where Greg.ppk is a key that I created with PuTTYgen.

One more step: tell git to use plink, PuTTY's client for non-interactive connections. Set the environment va

answered 2010-09-02T14:42:42.883

Your Answer