Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh authenticated git access at windows command prompt?

Tags:

git

windows

ssh

There are many fine instructions about how to work with git under windows using GitBash.

I note that when git is installed, it offers the option of "set up for using git from the windows prompt", which puts git on the windows path.

Is there some way to set this up so that ssh authentication works?

At the moment I get "permission denied (publickey)" when I try to do git commands that access the remote.

(edit) I have set %HOME% to point to my Windows home directory, and there is a .ssh folder in there with id files that work under a gitbash shell.

I appreciate that the answer is likely "no, this is why GitBash exists". But - it would be good to know for sure.

If the answer is "no" it kinda makes you wonder why you would bother putting git on your windows path?

like image 955
GreenAsJade Avatar asked Sep 07 '13 00:09

GreenAsJade


People also ask

Which ssh does Git use on Windows?

OpenSSH, the open source version of the Secure Socket Shell (SSH) tools, is a standard part of the Windows 10 and Windows Server 2019 operating systems. This greatly simplifies how to connect to GitHub with SSH on Windows.

Where does Git get SSH key from Windows?

It's in %HOMEDRIVE%%HOMEPATH%\. ssh . Note that GitHub for Windows normally uses SSL; SSH keys won't have been created unless you've used an SSH repository with it at some point. Save this answer.


1 Answers

ssh access works fine from a regular DOS session.
You only need to define C:\Users\YourAccount\.ssh and add your id_rsa and id_rsa.pub there.

Launch your git session through git-cmd.bat, which will define %HOME% to your C:\Users\YourAccount: that is what will make ssh work.

This should put your msysgit/bin installation in your PATH.

I really recommend not installing through a msi (Microsoft Installer), but through a simple unzip of an archive (portable version "PortableGit-x.y.z-preview201ymmdd.7z")

And the OP GreenAsJade's comment points out the fact that GIT_SSH must point to plink.exe.

like image 123
VonC Avatar answered Nov 08 '22 18:11

VonC