6

My team transferred our tfs from an old server to a new one a little bit ago. We are using git tfs to manage our local changes and to push them into tfs.

However I am running into an issue when I clone a exsisting repo from tfs like so

git tfs clone http://our.new.tfs/tfs $/project "myrepo"

Git is able to connect to the new server and pull everything down. I can then make changes and commit them with no problem. It isn't until I try to do a git tfs pull or git tfs checkintool this I get an error saying:

Unable to locate a remote for <http://our.old.tfs/tfs>$/project

When I check the config the url is defined as http://our.new.tfs/tfs so I do not know where it is getting the idea to pull from the old server.

I have tried deleting the remotes section from the config file and do a git tfs init [remote] but still the same error comes up. I have even scraped the repo and started with a fresh clone but still the same thing. It always points to the old server and not the new one.

I have been looking online for hours but with no luck in finding a solution. Please let me know if you can provide any helpful advice!

Thank you in advance!

jpalladino84
  • 2,480
  • 2
  • 15
  • 16
  • This question (and solutions) also pertained to me when we switched TFS servers, but I was able to keep my existing git-tfs clones. Editing `.git/config` and adding a `legacy-urls` entry to `[tfs-remote "default"]` allowed me to keep using my existing clones with the new TFS server. – Greg Burghardt Sep 09 '15 at 17:51

2 Answers2

9

I actually found my answer so I will post it here in case anyone else runs into the same issue!

You have to add your old url to the list of legacy-urls like so:

git config tfs-remote.default.legacy-urls http://your.old.url/

I hope that helps for anyone that has or will be pulling their hair out in the future!

jpalladino84
  • 2,480
  • 2
  • 15
  • 16
4

Or edit the config file located under .git and change the url to the new location and add the legacy url.

[tfs-remote "default"]
    url = http://your.new.url
    legacy-urls = http://your.old.url
Greg Burghardt
  • 17,900
  • 9
  • 49
  • 92
  • This totally did the trick! Thank you so much, I just edited the `.git/config` file and I am back in business (we moved the TFS 2013 to the cloud as a first step of migration to Azure DevOps 2020 installed product) – timmi4sa Oct 06 '22 at 14:35