2

I have a local git repository and i would like to convert it to TFVC version control and then load it to TFS server. Does anyone have an idea how to do it ?

sila
  • 179
  • 4
  • 14
  • Possible duplicate of [Migrate Git repository to new TFVC repository](https://stackoverflow.com/questions/40349494/migrate-git-repository-to-new-tfvc-repository) – Daniel Mann Jan 23 '18 at 15:38
  • The duplicate doesn't mention the configure command in the answer below. – ckkkitty Sep 19 '19 at 18:10

2 Answers2

3

To migrate Git repo to TFVC repo, you need to install git-tf tool at first.

And also make sure you have added a TFVC repo before migration. And assume the TFVC repo name is projectname.

After installing git-tf successful, then use below commands to checkin the files and histories in TFS TFVC repo:

cd /payh/to/local/git/repo
git tf configure http://tfs-server:8080/tfs/DefaultCollection "$\projectname"
git-tf checkin --deep --autosquash

Now all the files and histories in your git repo are checkin your TFS TFVC repo.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • Actually, i tried git-tf , i installed it then i added the environment variable but when tried to excute the command i got this error : "git: 'tf' is not a git command. See 'git --help'. Did you mean this? tag" – sila Jan 23 '18 at 10:34
  • 1
    try git-tf instead of git tf – BAHRI Abdelhak Jan 23 '18 at 11:15
  • @sila Add the folder to your path (and restart the console) should solve this problem. – Philippe Jan 23 '18 at 12:31
  • @sila If `git tf` is not recongnized, that means it didn't install correctly. As the **Installing** part of document https://gittf.codeplex.com/ instruct, you should extract the zip file and add the git-tf and java.exe in environment path. – Marina Liu Jan 24 '18 at 01:28
  • git-tf is now recognized thanks, i just got another error : "A server path must be absolute" – sila Jan 24 '18 at 08:11
  • Local branch must be named “master”. If you get "git-tf: 'refs/heads/master' is not a valid ref." error, go to Git repository branches and try to rename local branch to "master". – tibx Sep 20 '22 at 06:45
0

If you are on TFS 2017 update 1 or higher, you could directly import your existing Git Repo to the TFS Server

If you would like to really migrate your Git repo you could take a look at this thread for details here.

Danko Valkov
  • 1,038
  • 8
  • 17