简体   繁体   中英

cloning a git-tfs central repo, and hiding TFS

I have a code repository in TFS (Microsoft Team Foundation Server). I can use git-tfs to convert this to a git repository.

But what I want to do is set up one central git repo that pushes to TFS, and have all developers clone that git repo and not be able to push to TFS. As far as anyone "downstream" from the central repo., I don't want any indication there's a TFS repo at all.

Since the TFS server information is included in the repo produced by git-tfs, how can I do this?

There's several problems need to be solved for this to work. Most prominent is mapping from git users to TFS credentials that will be used when checking in changes back to TFS.

And other troublesome thing is possible conflict with other TFS users (ie if someone decides to push things to TFS directly).

That is why it wasn't developed as part of git-tfs I believe (at least that is why I didn't added this feature several months ago).

If you're ok with having TFS login/password pairs in plain text file, and you can ensure conflict-free workflow (eg to prohibit checkins to TFS in any other way except through your git central repository) - you can implement what you need with commit hooks or even with simple scheduler (so pushing will be not immediate, but deferred and asynchronous, thus speeding up pushing to git central repository significantly).

Actual script should be pretty straightforward, but nobody bothered to write one yet (at least I don't know of such thing).

Firstly, strip off TFS metadata from your commits using the --no-metadata flag. Then use the --authors="path-to-authors.txt" flag to map your TFS users to current.

git tfs clone http://tfs:8080/tfs/DefaultCollection $/Project1 --authors="c:\project1\authors.txt" --no-metadata

In your authors.txt, map your users TFS id to their email like this:

TFSDOMAIN\peter.pan = Peter Pan <peter.pan@disney.com>

After cloning the repo, run git tfs bootstrap and remove the TFS configuration in your .git/config file. You now should not be able checkin to TFS but still be able to share the repo among your developers.

More details on git tfs clone https://github.com/git-tfs/git-tfs/blob/master/doc/commands/clone.md

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM