Dave
Dave

Reputation: 19110

Why is git asking me for a password?

I'm using Windows XP, TortoiseGit (latest version) and Cygwin. I have git.exe installed and on my path. In TortoiseGit, I can execute pushes against the remote repository without being prompted for a password. I assumed this was because I have defined this in my .git/config file ...

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = ssh://git@myrepo/myproject.git
    puttykeyfile = U:\\.ssh\\mykey.ppk

However, in Cygwin, when at the root directory of my project (the one where the .git folder is a child), I get prompted for a password ...

$ git push origin qa_release
git@myrepo's password:

Why am I prompted for a password when trying to push from Cygwin but not from TortoiseGit and how can I get Cygwin to behave like TortoiseGit (i.e. not ask me for a password)?

Thanks, - Dave

Upvotes: 2

Views: 4449

Answers (1)

user587717
user587717

Reputation:

puttykeyfile is a windows git thing, so you need to have your SSH set up for cygwin too. Git will use your regular SSH settings.

Is the .ppk file a regular SSH public key? If so, add the following to your ~/.ssh/config file, so cygwin git knows where to find it.

 Host myrepo
     IdentityFile /cygdrive/u/.ssh/mykey.ppk

You can test this quickly with a ssh myrepo in cygwin.

Upvotes: 2

Related Questions