Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running git from Windows Cmd line: Where are key files?

Tags:

git

ssh

msysgit

So I've installed msysgit, and run git successfuly from the bash shell.

From within the bash shell, I've created keys with ssh-keygen - everything works fine.
Key files are in my %userprofile%\.ssh folder (from the bash shell, it is: ~/.ssh).
I'm able to connect to my server (unfuddle in my case).

Next, I do want to be able to run git from the Windows Cmd shell.
Adding c:\msysgit\bin and c:\msysgit\mingw\bin to the search path.
Git is working locally just fine: branch, merge, add, commit, checkout, ... working well.

However, trying to work with the server fails, with: 'Permission denied (publickey).'
It looks like git, when executed from command line looks at a different location trying to allocated the key files, or another reason causing it to fail.

like image 965
Uri Avatar asked May 25 '11 15:05

Uri


People also ask

Where are git keys stored Windows?

The public part of the key is saved in the id_rsa. pub file, while the private part is saved in the id_rsa file. Both files can be accessed from this location using Explorer: C:\Users\[your user name]\. ssh .

Where are git keys stored?

Keys on your computer SSH keys are stored in the ~/. ssh folder.

Where does git look for ssh keys on Windows?

The default location is: %HOMEDRIVE%%HOMEPATH%\. ssh\id_rsa. pub . That would expand to something like C:\Users\dennis\.

Where does git bash find ssh keys?

The same applies for git bash : the keys will be in ~/. ssh .


1 Answers

To get the mysysgit command line to find the .ssh keys you'll need to have %HOME% point to the directory containing the .ssh folder

Often you can just do

set HOME=%USERPROFILE% 
like image 76
JaredPar Avatar answered Sep 19 '22 17:09

JaredPar