I have to migrate the code from TFS to Azure DevOpsService Git repository. For that, I am using "git-tfs". The cloning of tfs code using "tfs-git" is ok. However, when I tried to push the code to remote origin, I am facing the issue. I tried the following approaches -
- In an empty folder, I did
git init, thengit clone <remote Git>. After that, I rangit tfs clone <TFS-url> <TFS folder. I removed the traces of "Config" and "Description" files inside.git/repository (just removed the references of . When I tried to push the code by executinggit remote add origin <remote Git Url>andgit push –u origin –-all, I got the error likeOuter clone contains inned clone. Do you want to create submodule?I can understand that because in the folder, cloned from TFS, there is already a '.git' folder. Instead of that, I tried normalgit add .,git commitandgit push, I got the response as "everything is up-to-date" but nothing is really pushed to remote origin. - Second, I tried with another empty folder. I did
git initbut did not clone from the remote origin. Then I cloned the TFS code from TFS server using "git-tfs". This time, there was no 'outer clone', so I thought everything would be smooth. However, as I didgit init, so there was a.gitfolder already created. Again, I got the same error. - I tried again by taking a fresh directory. I did not do
git init. I even cloned the TFS code in a different directory and then copied to the empty directory. After setting the origin, when I executedgit push –u origin –-all, I got the message thatUpdates were rejected because the tip of your current branch is behind. Use git pull before pushing again.When I triedget pull, I got the message,fatal:regusing to merge unrelated histories. How to fix the issue ?





I recommend you follow https://learn.microsoft.com/en-us/azure/devops/repos/git/import-from-tfvc?view=azure-devops
This will allow you to keep history from your TFSVC repo in your new git repo.