Designate a non-Github repo as a remote on Github

2019-08-27 00:21发布

问题:

I'd like to sync a repository between a corporate Github and a corporate TFS. TFS UI don't support remote repositories on the server.

Is there a way to designate the git repo within TFS as a remote on Github? I know I can sync via a local repo that would list both as remotes, but can this be done without a local one?

回答1:

Unfortunately, there isn't such an official tool or services. You have to manually do the sync via a local repo as you mentioned.

If you are using a Git repository in TFS then you can create set up two remotes in a local Git repository, i.e

git remote add upstream https://github.com/foo/bar.git
git remote add origin https://tfsserver/DefaultCollection/_git/bar

And then simply do a git pull upstream master followed by a git push origin master assuming that master is the branch that you want to keep in sync.

With either version control system, you probably want to keep a branch in version control in your TFS repository to match what is in your upstream GitHub project so that you can easily see change coming in the one place and then handle your merges inside your local repository.

Source Link: Integrating Github code to TFS - auto check-in

Another workaround is with help of a special build in TFS, then calling git command during the build pipeline. Detail steps please refer this blog: Keep Git repository in sync between VSTS / TFS and Git. You could also use the Git Tasks in marketplace.

Also reference this article : Sync between my GitHub and Visual Studio Online

You can also submit a user voice to suggest the feature on this site: https://visualstudio.uservoice.com/forums/330519-team-services