Reputation: 1479
I have an issue with Team City 8.0.3 (build 27540) hanging on a secondary build step that pushes changes to a remote repository. I can't locate any information that gives me insight into what's wrong.
The VCS is setup via SSH, using the default private key, and checkout mode is set to automatically on agent.
Source is checked into a "repositoryPath" via a checkout rule.
Build step runs git commands from the working directory of "repositoryPath".
Here is the build log from the second step that runs the commit:
Step 2/2: Commit dlls (Command Line) (running for 1m:09s)
[16:46:51][Step 2/2] Starting: C:\TeamCity\buildAgent\temp\agentTmp\custom_script5045114249582743499.cmd
[16:46:51][Step 2/2] in directory: C:\TeamCity\buildAgent\work\8df15579b05cdb68\repositoryPath
[16:46:51][Step 2/2] [master 9fa24ba] Teamcity update
[16:46:51][Step 2/2] 1 file changed, 0 insertions(+), 0 deletions(-)
*** HANGS HERE ***
Here is the git push command line step:
"%env.TEAMCITY_GIT_PATH%" add .
"%env.TEAMCITY_GIT_PATH%" commit -m "Teamcity update"
"%env.TEAMCITY_GIT_PATH%" push
If I drop to the the Team City work directory, I notice that the commit has taken, but hasn't been pushed. If I attempt a git push
, it goes off without any problem.
I would be happy to furnish further detail if it would help.
Upvotes: 4
Views: 4137
Reputation: 771
I had this problem, but as I was using SSH I couldn't specify the username and password in the command. I knew the build was hanging because it was waiting for a user prompt.
I noticed that even though I had a HOME system environment variable set to where the .ssh folder was, it was not present in the SET list when TeamCity ran the git push
command.
Consequently I changed the script to reset the HOME variable:
SET HOME=D:\
git push
...where D:\ is where the .ssh folder is containing the public/private keys.
Upvotes: 1
Reputation: 6541
As a comment above also suggests, the root cause is probably git asking for a password, which is never supplied by TeamCity.
Try configuring git so that it doesn't request a password (e.g. setup ssh keys/use wincred/git-credential-winstore).
Or if you're using GitHub and are are happy to put your password in the url (as suggested by this post):
git push https://username:[email protected]/username/repository.git
Upvotes: 2
Reputation: 4923
TeamCity uses cmd.exe to run your git commands. As this stackoverflow answer says, Git relies on the shell scripting, which is not available inside cmd.
Try to call msysgit's bash to execute a bash script with required git commands.
Upvotes: 6