TFS with git repository and Stash integration - is it possible?

With TFS 2013 Microsoft supports git repository. I was wondering is it possible to have Stash and TFS on the same "central" repository?

My goal is to have the same repository that is hosted in TFS (all devs are pushing and pulling to it) also to be served by Stash? Stash have a lot of features that I would like to see in addition to the existing TFS ones.

1 answer

1 accepted

0 votes
Accepted answer

Hi Nikolay,

The answer is "it depends". Being a distributed version control it's easy to host the same Git repository in multiple places (eg TFS and Stash). By that I mean you can have a copy of the repository in Stash and TFS, but you will still need a way of manually keeping them in sync. For example you might set up a CI build that periodically pulls from TFS and pushes back to Stash.

Where things get tricky is when you want to push or update both of them at different times. At that point you have to deal with the possibility that the same branch will be modified (differently) in both places and then you will need someone to manually dealing with the "conflict", at a minimum you will need to merge the two branches and push back to both of them. Basically it's easier if you don't allow it at all. :)

If you just want to have Stash as a read-only copy and use it for browsing and such then that should work fine. You can even create pull requests for reviews, although I wouldn't recommend you actually do the merge directly in Stash. You may even want to add branch permissions to restrict everyone (but the CI build) from accidentally pushing to the wrong place.

Does that make sense?


If the goal was to have them somehow working - yep that will do the job, but I do not see realy the value of doing that in my situation. I will kinda loose the "live" view of the code and etc.

I would of be realy happy if the internal directory for given repository in Stash is configurable.

For example if TFS creates the central project repo under "c:\Program Files\TFS\Repos\Project1"

I would of just set that path in Stash cofing for ex:"Stash Project1 Options - server repo path" and Shash would picked up and do its magic :)

Do you expose configuration like that?

Hi Nikolay,

I'm afraid it's not quite as simple as making the two share a single filesystem. Stash needs to be notified when changes occur so we can update our various indexes. If you're not pushing to Stash directly then it will stop functioning as expected. The same would almost certainly be true for TFS or any non-trivial Git hosting solution. In any case we don't expose that configuration and I highly recommend that you don't do it.

Depending on how frequent you run a sync builds, which would only take a few seconds, or better yet have them trigger off a webhook (ie when someone pushes), the view would extremely close to "live".



Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

241 views 3 7
Read article

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