SSH setup for Windows not working

Padmanabha Kamath May 17, 2018

I have followed the instructions at - https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html and the SSH keys are set up.  I was able to pull the repo down from remote and do some work.  However, the following issues still persist.

- I cannot do any git operation from the Windows command prompt with the root at the local repo. All ssh commands fail because ssh is not recognized as a command.

- WORKAROUND - I can do git operations from the "Git Bash prompt". This is less than ideal but even this workaround is problematic because I have to do this EVERY time I get into the local repo.

  1. Open a git bash prompt (Right click inside the dir and do "Git bash here").
  2. start the ssh-agent (eval $(eval-add))
  3. Add the key (ssh-add /Users/<location of key>)

After this I can go fetch, push, pull etc. Doing this EVERY time is a pain and I'd prefer doing the stuff from the Windows prompt because nobody in my team is comfortable with Linux. 

Any documentation for doing this ?

2 answers

0 votes
Paul Sherman
Contributor
October 26, 2022

Hi @Padmanabha Kamath , the note by @Ana Retamal is spot on, re: the open source git client for Windows (See git-scm.com). There are a few critical mistakes in the Set up SSH for Git on Windows section of the support document (which is otherwise very good, complete, clear, and well-written).

Step 1 has four parts, numbered 1, 2, 3, and 4. They are all correct and work well.

Step 2 has two parts, numbered 1 and 2. However, this is where the trouble starts. Seems that it is copied from Linux instruction. First, Windows' paths are backslashes, whereas Linux paths are forward slashes. Second, as of Windows 10, the SSH Authentication Agent is, by default, disabled. Thus, the two parts in Step 2 need to look something like this:

1. To start the agent, run the following:
From the Windows desktop, select START -> All apps -> Windows Administrative Tools -> Computer Management
Under Services and Applications, select Services and click Standard tab
Double-click OpenSSH Authentication Agent
Change Startup type to Manual
Click Apply button
Click OK button
Close the Computer Management window
At the Command Prompt, type ssh-agent to start the SSH server

2. Enter ssh-add followed by the path to the private key file:
ssh-add c:\Users\emmap1\.ssh\<private_key_file>
where private_key_file is, for example, id_rsa (without the .pub suffix!)

Step 3 has eight parts, numbered 1 through 8. They are all correct and work well. Part 3, however, should refer to the public key filename that looks something like this:
c:\Users\emmap1\.ssh\id_rsa.pub

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 24, 2018

Hi Padmanabha! There is no native Git native client bundled with Windows. The steps described in your workaround are correct, though.  

As an alternative to Git bash you could use a UI Git client, like for example Sourcetree. Sourcetree is a free Git client that we provide and you can find at sourcetreeapp.com.If you prefer, you can find other options at Git GUI Windows.
Hope that helps!
Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events