Bamboo fails to push tags to Git repo

I am using Bamboo 5.2 to build and test solutions stored in Git and managed by Stash 2.8

At the end of a build I want to create a Git tag and push it back to the Stash-managed repo. There appears to be no built-in support for this for Git, just for SVN - is this to be provided in a future release?

Lacking this, I have created an inline script which issues a number of commands

cd ${}\solution
"C:\Program Files (x86)\Git\bin\git.exe" tag "${bamboo.buildKey}_${bamboo.buildNumber}"
"C:\Program Files (x86)\Git\bin\git.exe" remote add origin ssh://git@ip_addr:7999/project/solution.git
"C:\Program Files (x86)\Git\bin\git.exe" push --tags origin

The "tag" and "remote" commands execute but the push hangs, resulting in the build hanging and no log file (presumably buffered in memory and lost on stopping the build). If I type these exact commands in a bash or command window as the same user as that running the build agent, they work.
I googled for help and found which suggests a work around but I couldn't get it to work either.

I also note that a similar question at has gone unanswered...

What am I missing?

6 answers

1 accepted

1 vote
Accepted answer

Thanks for the advice. I've tried the relatively unsecure http with password as Charles suggests and it has worked. i.e.

"C:\Program Files (x86)\Git\bin\git.exe" push --tags http://user:password@ip_addr:7990/scm/project/solution.git

I had tried disabling shallow clones as comments elsewhere on the internet suggested that there may be problems - this is why I had defined the remote as not being a full clone meant that it was not set up by default. But it made no difference.

I will now re-experiment with SSH, and try the Cygwin version as well. If I have to leave it like this then this won't really be a problem as we have a standard build user account with password that most people know and so the security risk is low.

I'll leave off accepting until I've looked into this a bit more (tomorrow) and post an update.

The authenticity of the host was not verified.. git was asking you to type 'yes' or 'no'

We're using bamboo on windows and checkout via https there. This is my solution:

Create _netrc file under bamboo service user account home.
login username
password password



Then, create a script task with following content to change remote url right after checkout

git remote set-url origin ${bamboo.repository.git.repositoryUrl}

And don't forget to set the git user:

$ git config --global "bamboobuild"
$ git config --global

The log:

build	08-Oct-2014 09:45:49	GitTag:
build	08-Oct-2014 09:45:49	  Read C:\b\SA-ICG0-JOB1\tagversion.txt
build	08-Oct-2014 09:45:49	  git tag -a "v1.2.1" -m "Release from master tagged with v1.2.1!" -m"***NO_CI***"
build	08-Oct-2014 09:45:49	  git push origin "v1.2.1"
build	08-Oct-2014 09:45:51	  To
build	08-Oct-2014 09:45:51	   * [new tag]         v1.2.1 -> v1.2.1



The hanging is very strange. Do you have any kind of passphrase on the SSH key? As an experiment you could try use the HTTP URL (and hard code the username/password). If that works it's probably something to do with SSH.

You might want to disable 'shallow clones', it's an option under 'advanced' and I believe it's the default. I don't see how that would cause the hanging, but it's worth a shot.

I'm afraid I work on Stash and I couldn't say if Git will be added to the VCS Tagging plugin in future.


0 votes

Try redirecting the input to git from NUL like "git whatever <NUL" - maybe there's some interactive input required?

Also if you're using SSH distributed with Git, it's horrible - try using the one from Cygwin, it's approximately 10 times faster (also more stable).


In mycase i am trying to push the jar generated back to Git.

So i have created and inline script with

git init

git add myjar and

Tried wit the

but this was not worked any idea or sugession please

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Statuspage

Introducing Statuspage Getting Started guides! First up: What is Statuspage?

Over the next several weeks we'll be sharing some of our Getting Started guides here in the community. Throughout this series of posts, we'd love to hear from customers and non-customers ab...

45 views 3 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you