Henrik Henrik - 2 months ago 22
Git Question

TeamCity: On successful build push to Git Repo

Can TeamCity push successful builds to a git repository?

I cannot see a specific build step in TeamCity to do this.

I use the version 7.1.1 of TeamCity

Thanks, Henrik

UPDATE:

Ok thanks for your answer,
I find it a bit complicated.
I found out that I can simply push back tags on successful builds to my global repository from which TeamCity fetches data for the build. I can pull changes from it and see whether the last commits were successful.

I would be happy if TeamCity provided a simple option for this kind of workflow!

It would be awesome if every developer could just pull from a repo that is only updated when the build is successful, or am I wrong here?

Answer

You can have TeamCity execute a shell script that subsequently calls git push (with appropriate arguments, e.g. git push <repository> to push to a different repository). Do make sure that git doesn't need interactive authentication for the push operation.

A related example (deploy to Heroku using a git push) can be found here: http://blog.carbonfive.com/2010/08/06/deploying-to-heroku-from-teamcity/.

Comments