jef
jef

Reputation: 4083

How to specify git path in Cygwin terminal?

I installed Cygwin and TortoiseGit. And I created ssh-key by ssh-key-gen -t rsa and registered public key to my GitHub page. When in gitbash terminal, it worked, however, Cygwin terminal failed.

// Cygwin
$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I noticed they use different git. Then, how do I specify git path in Cygwin? My OS is Windows 10.

// Cygwin
$ where git
C:\Program Files\Git\cmd\git.exe
$ which git
/cygdrive/c/Program Files/Git/cmd/git

// gitbash (MINGW64)
$ where git
C:\Program Files\Git\mingw64\bin\git.exe
C:\Program Files\Git\cmd\git.exe
$ which git
/mingw64/bin/git

Upvotes: 1

Views: 1750

Answers (1)

VonC
VonC

Reputation: 1324258

The git path itself is not that important for ssh.

What matters is the $HOME, because git (any git) would search for the public/private ssh keys in $HOME/.ssh

Double-check your echo $HOME output in both scenario, and check the result of ssh -Tv auser@aserver (replace user and server by the beginning of the ssh URL seen when typing git remote -v)

Also, Cygwin has its own Git package as I explain here.
And it needs a .bash_profile as a setting.

Upvotes: 2

Related Questions