19
votes

I am having trouble getting git/tortoisegit to use my supplied ssh key (created using PuttyGen). In the command prompt I get a permission denied error, and in the TortoiseGit UI I get prompted for a password. I tried this SO question, but as stated, I created with PuttyGen, have Pageant running with my keys loaded, and am configured to use TortoisePlink.

I then found this SO question, and tried to use the ssh in the git directory, the TortoisePlink in my TortoiseHG (used for Bitbucket/Mercurial), and as stated, had already tried the local TortoisePlink in TortoiseGit.

Oh, and I did set up my ppk in my Git account, as well as, in the Git->Remote section of TortoiseGit

So, what am I missing?

7

7 Answers

15
votes

Check what your origin url is.

Right click on your project folder TortoiseGit -> Settings -> Choose Git -> Remote and select the origin entry.

Check that the url starts with ssh:// and that your private key is loaded.

If the url starts with https:// then it will ask you for your password every time.

Hope this helps.

4
votes

I could not make this work with github/tortoisegit either. Using git from the command line on linux worked fine. I then resorted to using my username/password as described here:

http://www.programmoria.com/2012/02/saving-tortoisegit-password.html

and elsewhere. It is not a real solution (sorry) but a workaround that achieves the same thing: automatic authentication without having to enter your username/password. The _netrc file is as secure/insecure as the private key that would also be stored somewhere on your computer so I consider it an acceptable solution. Comments on this are welcomed of course.

4
votes

Some Git servers are somewhat counterintuitive (IMHO) when it comes to authentication. For instance, Github docs say:

All connections must be made as the "git" user.

So, instead of trying to connect to ssh://<yourname>@github.com..., you have to connect to ssh://[email protected]....

I am not asked for a password any more and TortoiseGit now shows Success after completing a Push operation.

1
votes

Does your account on the OpenSSH server know you should be authorized with your public key?

Load your key with PuTTyGen. You will see a read-only textarea under "Public key for pasting into OpenSSH authorized_keys file". Copy what's in there.

SSH with PuTTy into the SSH server. Open up the ~/.ssh/authorized_keys file with an editor and paste the copied text in a new line and save. The ~/.ssh directory may not exist yet. In that case, do mkdir ~/.ssh before editing that file.

1
votes

I was also facing the same problem on v1.8.4, then I switched my ssh client to plink and its working fine now. TortoiseGit Settings -> Network -> SSH client

plink is distributed along with peagent and other goodies in standard putty package

Apparently there is a bug in certain versions of TortoiseGit (TortoisePlink in particular) see this answer

0
votes

I am using git 2.7 and tortoisegit 1.8.16 Here is what I did to avoid requiring password and it worked for my case

Right click on your project folder TortoiseGit -> Settings Choose Git -> Remote and select the origin entry Change url from https://github... to ssh://git@github...

0
votes

Using Tortoise 2.2.0.0, you need to do a couple of things. On the remote tab, you can either remove the http(s) origin you already have or you need to add a second, using ssh:// and checking the "Push Default" checkbox for the ssh one so that Tortoise uses it for pushes by default (and the https origin in my case for pull).

Only the ssh one needs the key specified and then when you Push, it should default to your new ssh origin as the destination and not ask for your username and password.

Obviously you need to know what user to have in your URL. For example, in Visual Studio Team Services, it is the name of the VSTS account (not account holder!). You might also need the port number.

That's all I did to setup from scratch and it worked fine.