Fedcomp
Fedcomp

Reputation: 2425

msysgit git clone ignores ssh config

I've installed msysgit and git uses proper ssh.exe. All commands are executed in msysgit shell (program files x86 sh.exe). Then i set my ~/.ssh/config file to this

LogLevel DEBUG1

Host bitbucket.com
  HostName bitbucket.com
  PreferredAuthentications publickey
  IdentityFile /d/ssh/bitbucket.ppk
  IdentitiesOnly yes

Then ssh bitbucket.com works well:

$ ssh bitbucket.com
debug1: Connecting to bitbucket.com [131.103.20.173] port 22.
debug1: Connection established.
debug1: identity file /d/ssh/bitbucket.ppk type -1
debug1: identity file /d/ssh/bitbucket.ppk-cert type -1

but when i try to git clone [email protected]:User/reponame.git ssh debug messages shows me that ssh don't even try to pick bitbucket ppk, instead trying to use default keys:

$ git clone [email protected]:user/reponame.git
Cloning into 'reponame'...
debug1: Connecting to bitbucket.org [131.103.20.168] port 22.
debug1: Connection established.
debug1: identity file /c/Users/bob/.ssh/id_rsa type -1
debug1: identity file /c/Users/bob/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/bob/.ssh/id_dsa type -1
debug1: identity file /c/Users/bob/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/bob/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/bob/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/bob/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/bob/.ssh/id_ed25519-cert type -1

I'm out of ideas.

$ where git
C:\Program Files (x86)\Git\bin\git.exe
C:\Program Files (x86)\Git\cmd\git.exe

Upvotes: 1

Views: 861

Answers (2)

VonC
VonC

Reputation: 1323753

git clone [email protected]:User/reponame.git would look for ~/.ssh/id_rsa and id_rsa.pub, not for /d/ssh/bitbucket.ppk.

What should work (since ssh bitbucket.com does work) is:

git clone bitbucket.com:User/reponame.git

That would actually use the parameters defined in the ~/.ssh/config file.

bitbucket.com is the entry in the config file (it could be named anything really), but the HostName must be indeed bitbucket.org, which is the domain where the Git repos are stored.

Upvotes: 1

Fedcomp
Fedcomp

Reputation: 2425

The reason was my own inattention. Bitbucket uses bitbucket.org for repos. Afaik, before it used bitbucket.com.

Upvotes: 0

Related Questions