Windows Git Ssh Config File

(The OpenSSH equivalent of Pageant is ssh-agent, by the way.) Edit PuTTY's default configuration to point to the key. Open a new PuTTY window, go to Connection → SSH → Auth, and choose your key file under Private key file. Go back to Session, click the 'Default Settings' item, and click Save. Installing SSH tools. The most common SSH windows utilities are the ones coming with Putty. Downloading Putty binaries. First you need to go to Putty binaries repository and download the following resources.

Active3 years, 3 months ago

How can I use ~/.ssh/config with Windows/PuTTY? Are PuTTY settings stored in the registry? I wish to have my PuTTY settings in git. So it needs to be a human readable text file.

Thomas Dickey
55.5k5 gold badges112 silver badges191 bronze badges
IvanovIvanov
5503 gold badges9 silver badges24 bronze badges

closed as off-topic by Jeff Schaller, garethTheRed, Jakuje, PersianGulf, MelBurslanMay 4 '16 at 22:45

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

Yes you can! But it's another path where the Putty settings are stored. Where exactly the Putty configuration is stored is system dependant, but you can use a PuTTY session name just as if you would use a hostname for ssh to use that with git, at least with the git port for windows. That way you can set the auto-login user or other session features with the PuTTY client, save a session under a name you can remember and use the saved session name as a git host.

Git for Windows can use both, an integrated ssh client and the putty client. I never tried that on linux. There are several guides how to use that, when you search the internet.

ikrabbeikrabbe

Not the answer you're looking for? Browse other questions tagged configurationgitputtygitlab or ask your own question.

Active6 months ago

I've been looking for a solution on how I can use multiple ssh keys and I figured out, that it will work with a config file in the .ssh directory, but it doesn't work on windows.

My problem is that I'm using a private key to access a git server, so it looks like this:ssh://git@example.com/directory , it works fine when I'm using TortoiseGit, 'cause there is a possibility to choose the private key.

But I want to use the git rep in my IntelliJ IDEA and there is just the option to use the git native shell and it also works, if I put the key, called id_rsa ,into the .ssh folder. Now I want to use multiple ssh keys (so my key will get the name 'id_rsa_test', so how do I configure the .ssh/config file under Windows, that it works with a usual git server?

The most examples I found yet are just for the use with github.

mathew11mathew11
1,4842 gold badges15 silver badges22 bronze badges

4 Answers

If you use 'Git for Windows'

add to ssh_config following:

ps. you need ssh version >= 7.2(date of release 2016-02-28)

LennyLipLennyLip

There is an option IdentityFile which you can use in your ~/.ssh/config file and specify key file for each host.

More info: http://linux.die.net/man/5/ssh_config

Also look at http://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/

phtsphts
3,4201 gold badge14 silver badges29 bronze badges

These instructions work fine in Linux. In Windows, they are not working for me today.

I found an answer that helps for me, maybe this will help OP. I kissed a lot of frogs trying to solve this. You need to add your new non-standard-named key file with 'ssh-add'! Here's instruction for the magic bullet: Generating a new SSH key and adding it to the ssh-agent. Once you know the magic search terms are 'add key with ssh-add in windows' you find plenty of other links.

If I were using Windows often, I'd find some way to make this permanent. https://github.com/raeesbhatti/ssh-agent-helper.

The ssh key agent looks for default 'id_rsa' and other keys it knows about. The key you create with a non-standard name must be added to the ssh key agent.

First, I start the key agent in the Git BASH shell:

Then I change to the directory where I want to clone the repo

I fought with this for a long long time.

Here are other things I tried along the way

At first I was certain it is because of file and folder permissions. On Linux, I have seen .ssh settings rejected if the folder is not set at 700. Windows has 711. In Windows, I cannot find any way to make permissions 700.

After fighting with that, I think it must not be the problem. Here's why.If the key is named 'id_rsa' then git works! Git is able to connect to server. However, if I name the key file something else, and fix the config file in a consistent way, no matter what, then git fails to connect. That makes me think permissions are not the problem.

A thing you can do to debug this problem is to watch verboseoutput from ssh commands using the configured key.

In the git bash shell, run this

Note, the user name should be 'git' here. If your key is set up andthe config file is found, you see this, as I just tested in my Linux system:

Windows Git Ssh Config Files

On the other hand, in Windows I have same trouble you do before applying 'ssh-add'. It wants git's password, which is always a fail.

Again, If i manually copy my key to 'id_rsa' and 'id_rsa.pub', then this works fine. After running ssh-add, observe the victory in Windows Git BASH:

Git config set ssh

You would hear the sound of me dancing with joy if you were here.

To figure out what was going wrong, you can I run 'ssh' with '-Tvv'

In Linux, I see this when it succeeds:

In Windows, when this fails, I see it looking for default names:

That was the hint I needed, it says it finds my ~/.ssh/config file but never tries the key I want it to try.

I only use Windows once in a long while and it is frustrating. Maybe the people who use Windows all the time fix this and forget it.

Windows Git Ssh Config File File

Community
pauljohn32pauljohn32

For me worked only adding the config file that was on the dir ~/.ssh/config on my Linux system on the c:Program FilesGitetcssh directory on Windows.

After that, I was be able to use all the alias and settings that I normally used on my Linux connecting or pushing via SSH on the Git Bash.

coderadecoderade

Windows Git Ssh

4,1213 gold badges24 silver badges43 bronze badges

Not the answer you're looking for? Browse other questions tagged gitsshintellij-idea or ask your own question.