MattM
MattM

Reputation: 1289

How to make git push work with Cygwin?

After a lot of googling and troubleshooting, I believe I've determined that Cygwin doesn't send its SSH private key when SSHing unless you explicitly tell it to. I can do this in my SSH config file with the line IdentityFile, but I don't know how to get it to do this when using git too.

This time, I'm specifically trying to push to GitHub. My SSH key has been added. Previously, I couldn't SSH in until I set up my config file and added that IdentityFile line. Now I can successfully SSH into GitHub, but can't git push.

Anyone know how to get around this?

Thanks a ton!

Edit: To be clear, when I try to git push, I get the following error:

$ git push
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

But I can SSH just fine:

$ ssh github
Hi ______! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

Edit2 with solution:

User 'Cupcake' suggested adding my key to ssh-agent. I ran:

$ ssh-add <private key path>

And now it works. Thanks!

Upvotes: 4

Views: 2751

Answers (1)

alexgophermix
alexgophermix

Reputation: 4279

I personally use PuttyCyg to Putty directly into my Cygwin installation. This has the benefit of giving me access to Putty's ssh implementation, as well as Putty's terminal which I found to be more easily configurable and less buggy than Cygwin's.

For a list of instructions on how to set up PuttyCyg as well as some notes and configuration files see the effective-cygwin GitHub page.

Upvotes: 1

Related Questions