1

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 
1
  • with cygwin uses its git. it will make easier to manage the ssh-key created with cygwin ssh-key-gen Commented Oct 6, 2017 at 6:06

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

$HOME set correctly and ssh authentication was success by ssh -Tv. I still think this git is not set correctly.
@jef can you set the environment variable GIT_SSH_COMMAND (set on CMD, export on bash) to ssh -v, and see in both case what happen on git pull? There should be a difference.
@jef And you did not mention you were using a passphrase-protected ssh private key (stackoverflow.com/q/46627127/6309)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.