Running Git command to SSH URL hangs on Windows agents

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

When executing a Git command that connects to a SSH URL in a Script task, the task just hangs. Example:

git clone ssh://git@stashurl:7999/scm/proj/repo.git

Cause

When Bamboo script task runs, it's executed as a UNIX Bash script by default. Git looks for the SSH private key in %HOME%/.ssh/id_rsa. %HOME% by default is not set in Windows as it's defined as %USERPROFILE%.

Hence, when the Git command is ran, it can not find the SSH private key needed. 

Workaround

When using a script task (non PowerShell), set the $HOME variable before running any Git commands:

set HOME=%USERPROFILE%


Resolution

Run the script as a Powershell script to use Windows variable names instead of UNIX variable names.

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.