Running Git command to SSH URL hangs on Windows agents
問題
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
原因
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.
回避策
When using a script task (non PowerShell), set the $HOME variable before running any Git commands:
set HOME=%USERPROFILE%
ソリューション
Run the script as a Powershell script to use Windows variable names instead of UNIX variable names.
Last modified on Mar 30, 2016
Powered by Confluence and Scroll Viewport.