Git Bash and Pageant are not using keys

ssh using git bash
git windows ssh key
git config ssh key
git bash ssh
git use putty
how to use git in windows
windows ssh key location
git bash ssh-agent

I've got Git for Windows (configured for MinTTY and PuTTY\plink.exe) and PuTTY installed, and I am trying to get it to work with a Bitbucket repository. I've got my SSH key loaded, in Pageant and on the website, and yet whenever I attempt to do anything that requires pulling/pushing:

Permission denied (publickey).
fatal: Could not read from remote repository.

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

When I run the suggested ssh -v hg@bitbucket.org it uses id_rsa but none of my other keys in ~/.ssh. Trying to use ssh-add ~/.ssh/bitbucket_rsa results in:

Could not open a connection to your authentication agent.

I've read about configuring PuTTY to allow forwarding, but that's usually where the advice ends, so I just set this option for the default session and saved it there.

I've run ps to check which applications were running, and ssh-agent was not among them. Running eval 'ssh-agent' starts the daemon, but it makes no difference.

Fix git to work with pageant keys, If pageant (Putty) keys suddenly stop working with your git .com/questions/​35110079/git-bash-and-pageant-are-not-using-keys; Rapid  Git Bash & Pageant not using keys (3) I've got Git for Windows (configured for MinTTY and PuTTY\plink.exe ) and PuTTY installed, and am trying to get it to work with a BitBucket repository. I've got my SSH key loaded, in Pageant and on the website, and yet whenever I attempt to do anything that requires pulling/pushing:

You are mixing things up.

PuTTY and Pageant are not compatible with OpenSSH tools and can't communicate together. PuTTY can't read keys from your OpenSSH agent and OpenSSH can't read the keys from Pageant. The key format is also different. That is a bad thing in this world, but there is no solution on the horizon.

Also "agent forwarding" is something different than "using agent".

If you set up Git with plink (make sure you really did), check if your Pageant is running and if the option "Attempt authentication using Pageant" is checked in your stored profile in PuTTY under ConnectionSSHAuth.

If it will not resolve your problems, post some debug log from PuTTY.

Working with Git on Windows • Beanstalk Guides, Run pageant.exe , find its icon inside your system tray and add your SSH key. Open up a cmd and put the full path to PuTTY's plink.exe into the GIT_SSH  When using the git bash CLI, everything works as intended. I'm struggling with TortoiseGit. I first installed TortoiseGit with Plink and using Pageant to load ssh private key. The automatic authentication (Pageant) worked but setup was a fail as TortoiseGit don't recognize git repos url formatted as gitolite@gitbox/repo.git.

You don't need PuTTY to work with Bitbucket in ssh: the OpenSSH version (C:\prgs\git\PortableGit-2.7.0-64-bit\usr\bin\ssh.exe) packaged in git-for-windows works just fine.

Make sure that, in your current shell session, you have HOME set to %USERPROFILE% (a PortableGit-2.7.0-64-bit\git-cmd.exe is enough to open a regular CMD properly configured).

Create a file named config in %USERPROFILE%\.ssh (as in step 3 of the Atlassian documentation):

Host bitbucket.org
 IdentityFile ~/.ssh/bitbucket_rsa

(You can also use "/C/path/to/bitbucket_rsa".)

That allows to use an SSH URL like bitbucket.org:user/repo. Test it with ssh -Tv bitbucket.org (after adding your public key to your Bitbucket account, of course).

Note: ssh-agent is only needed if your private key is passphrase-protected.

Update 2018, two years later: "Say Farewell to PuTTY as Microsoft adds an OpenSSH Client to Windows 10". It is really time to ditch putty aside: no need for a different (ppk) key format and proprietary solution, now that OpenSSH is officially distributed as a Windows feature (in beta for now, Q1 2018).

How to use Git on Windows with PuTTY, When using TortoiseGit, you need to set the SSH key via pacey's directions. Note that all Git/SSH tools are supposed to be run from a cmd.exe in order not to In Git Bash, type 'cat ~/.ssh/id_rsa.pub', select the result, and copy it to the clipboard. git client you are using, however puTTY and its associated agent (​pageant)  And you need Pageant running with your key loaded. I have a shortcut to pageant in my startup folder that loads my SSH key when I log in. When you install git-scm you can then specify it to use tortoise/plink rather than OpenSSH. The net effect is you can open git-bash whenever you like and push/pull without being challenged for passphrases.

To access SSH keys loaded in Pegeant from Git Bash, that comes with Git on Windows, you can use this program. The installation process is described on the linked page.

How do I tell Git for Windows where to find my private RSA key , Enable SSH Agent Startup Whenever Git Bash is Started The only thing I would add to this is that if you are generating you keys with PuTTY Key SSH key(force new file format) and save the private key as just "id_rsa" NOT id_rsa.ppk the  Setting up Git can be tricky on Windows compared to Linux or Mac, but if you follow the steps in this guide, you should have no problems using Git on Windows. We’ve done the hard work and chosen between the multiple options at key steps to help make things easier for you.

What worked for me with Git Bash for Windows 7: convert .pkk file to OpenSSH format:

https://www.simplified.guide/putty/convert-ppk-to-ssh-key

Add generated key to IdentityFile .ssh/config at Git Bash, for example:

Host repository
     # My converted OpenSSH key
     IdentityFile /c/Users/me/open-ssh.pri

     # This repository server uses a specific name, not usually needed.
     User git

     # This repository server uses a specific port, not usually needed
     Port 8322

     # Repository server full name
     Hostname repo.server.com

Setup SSH Authentication for Git Bash on Windows · GitHub, When attempting to clone, push, or pull over SSH with Git or Mercurial, you may receive one Could not open a connection to your authentication agent macOS/Linux Check that Pageant is running and has a key loaded. PuTTY and Pageant are not compatible with OpenSSH tools and can't communicate together. PuTTY can't read keys from your OpenSSH agent and OpenSSH can't read the keys from Pageant. The key format is also different. That is a bad thing in this world, but there is no solution on the horizon.

Troubleshoot SSH issues, This means that you would need a set of SSH keys for Linux and one for To use this same set of keys in WSL, you first need to copy them over. not need to setup SSH keys on the Windows side, and the .ssh folder will not be present. keys in PuTTY Pageant or Gpg4Win then sharing them with WSL2. I'm using version 1.8.3.0. It would just hang when I put in an SSH URL while trying to verify if it was a git repo. The problem was that putty had not accepted the remote host key. The fix: try logging into the remote host using putty itself.

Sharing SSH keys between Windows and WSL 2, I even noticed that I do not care as much about passphrase and key We are going to use the SSH client of git bash which in turn is based on MSYS. This enables ssh to speak with the gpg-agent via the ssh-pageant . tortoisegit, openssh, git-bash, plink, pageant Pageant can load keys in PuTTY format (.ppk) only. You need to use PuTTYgen to convert the key from OpenSSH format to PuTTY format. Or even easier, use PuTTYgen to create the new key directly in PuTTY format, instead of using ssh-keygen.

OpenPGP on the Job – Part 8: SSH with OpenPGP and YubiKey, It holds your private keys in memory, already decoded, so that you can use them often without needing to type a  Launch it via the Start Menu (Putty -> Pageant) and then in the taskbar find the little computer icon and hit “Add key”. Then add your PuTTY private key. If your private key is not a PuTTY private key, open it in PuTTYGen (Conversions -> Import) and then save it as a private key (with extension.ppk). That should be it!

Comments
  • There is a great guide on how to solve it here: cgranade.com/blog/2016/06/06/ssh-keys-in-vscode.html
  • A comment about VSCode. Apparently I have tried using Power Shell in VSCode and the setup doesn't work without restarting VSCode. I have started the terminal once before adding GIT_SSH then pressed Kill Terminal and create a new instance of that. The npm install only recognize the ssh key after restart of VSCode.
  • I only attempted to run these commands because nothing else appeared to be working. I'm afraid however I still don't understand where I'm supposed to alter these settings in PuTTY. Am I supposed to create a PuTTY session configured specifically for bitbucket.org?
  • You can use the one you have.
  • I'm not sure what changed, because I had this set up on all connections and it wasn't working. I turned on the option to allow username changes, and it seemed to work (shouldn't matter right since it's supposed to match up the key itself?), then I disabled it and it still works.
  • This was the answer for me. Examples of the different, incompatible key formats are here.
  • I know I can use OpenSSH. I don't want to.
  • @DissidentRage Yet, that is what git is packaged with, and it is working just fine.
  • It's supposed to work with PuTTY. My work machine works with it correctly and without any of this fuss. If an answer doesn't make this work, it's not going to be marked as a solution.
  • @DissidentRage Do you have set GIT_SSH to putty? And do you have used putty to convert your openssh keys to a ppk one, that putty can actually read? (siteground.com/tutorials/ssh/putty.htm)
  • It's configured for PuTTY\plink.exe and yes, Pageant is set to use its own .ppk file.