My GIT setup runs fine within linux, but when I try to set things up under Windows (using git for windows and tortoisegit) I don't know where to put my private ssh key (or, better still, how to tell ssh where it's located). I'm using the standard ssh.exe option during installation of git for windows. The setup runs fine if I allow password authentication (in lieu of rsa) on the server.
|
For Git BashIf you are running msysgit (I am assuming you are) and are looking to run Git Bash (I recommend it over TortoiseGit, but I lean to the CLI more than GUI now), you need to figure out what your home directory is for Git Bash by starting it then type After you have the home directory, and a .ssh folder under that, you want to open PuTTYgen and open the key (.ppk file) you have previously created. Once your key is open, you want to select For TortoiseGitWhen using TortoiseGit, you need to set the SSH key via pacey's directions. You need to do that for every repository you are using TortoiseGit with |
|||||||||||||||||||||
|
|
Using the built-in SSH client shipped with Git for windows, you need to setup the HOME environment variable so that the Git SSH client can find the key. For example on a Windows Vista OS,
Made my day and fixed the issue with Git provided that your private key is not password protected. If you want to use ssh-agent, then you can probably run ssh-agent cmd.exe (although I've never done that) and the ssh-add as usual. Note that all Git/SSH tools are supposed to be run from a cmd.exe in order not to blink a window. If this does not work correctly, using plink can probably be achieved by tweaking GIT_SSH. Confer to all the svn+ssh tutorials, this is basically the same plumbing you need to setup. Good Luck ! |
|||||||||||
|
|
None of the answers above worked for me. Here was what worked for me in the end. It is actually fairly simple, if you know what to type. It doesn't need putty.
That's the bit on your own computer done. Now ssh into the destination server, then do
That's it! You're done! From git bash, do the following to test:
If it lists the files in your home directory on the git server, then you're done! Edit: for github, you dont have shell access to their server, but you can upload the key using their website, so for the bit 'now copy to your server', do:
|
||||
|
You can specify the Key Location for Tortoisegit the following way:
Screen shoot below:
|
|||||
|
|
|
Your private key needs to be added to the SSH agent on your workstation. How you achieve this may depend on what git client you are using, however puTTY and its associated agent (pagent) might do the trick for you http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html |
|||||||||||
|
|
I just set %HOME%=%HOMEPATH% This has the advantage of working for all users logged into the system (they each get separate .ssh folders). In Vista:
|
|||
|
|
|
The problem was that the |
|||
|
|
|
The following answer also applies to this question when running ssh from Windows Service Account: Jenkins (Windows Service) with Git over SSH |
|||
|
|
|
If you're using msysgit with the OpenSSH tools, you need to either create ~/.ssh/id_rsa, or create a git config in ~/.ssh/config which points to your key. Here's an example of a Git config for bitbucket that will use the correct username, and a key other than the default key (in case you maintain one key for SSH connections, and another for git accounts).
Once in git bash, you can run two commands to add your key to your current session's ssh-agent to avoid having to repeatedly type the key's password.
|
|||
|
|
|
Reading your comment to Declan's answer, try opening a command prompt first (Start -> Run -> cmd) and then navigate to that git/bin folder and run ssh-keygen. Theoretically that will generate an RSA key and place it in the appropriate directory. Then you just gotta find it and share your public key with the world. The reason that the window "blinks" is because windows run's the program, and when it executes, it closes the command prompt, thinking you're done with it, when you really need the output. Hope that helps! |
|||
|
|
|
There is a great guide to git for windows here that shows how to integrate putty and pagent for managing your keys. |
|||
|
|
|
I had similar issues and none of the answers here solved the problem. Turns out, my key pair were originally generated with an empty passphrase. (I know, dumb) Once I created a new keypair and uploaded the public key to github, things started working again. |
|||
|
|
|
You can specify both path to key and name of key file like so (on ubuntu). For example:
|
||||
|
|

