galenus galenus - 1 month ago 22
Git Question

Change default remote for git-tfs repository

I am working against the customer's on premises TFS server using the git-tfs bridge. Yesterday they migrated their installation to a new version + changed the URL of the server, migrating all the history and the work items to a new instance.

Is there a way to remap my existing git repository to the new default remote?

I tried to manually edit the url property of the [tfs-remote "default"] so it points to the new address and run every possible

cleanup*
command. However, on a fetch attempt there is a bootstrapping process adding a new tfs-remote with the old URL to the config file.

Answer

You've got 2 solutions:

The first, the easier, but I don't know if it works anymore (it should...) because git-tfs has evolved a lot since it was implemented.

Second, that will work for sure, is the update the metadata of the last changeset fetched from the old TFS and that is used by git-tfs to bootstrap the new tfs-remote when none is found in the gitconfig file.

Just amend the git commit and replace the url in the metadata (something looking like that: git-tfs-id: [https://tfs.codeplex.com:443/tfs/TFS16]$/vtccds/trunk;C26497 ) to point to the new TFS. Remove all the remote data in the gitconfig file like you did and let git-tfs bootstrap the remote toward the new server...