Pre-reqs:
- You need git on your PC.
- You also must install the git-tfs tool (https://github.com/git-tfs/git-tfs)
In Visual Studio Team Services create a new git repository.
The TFS project must be a branch – if not open Source Code Explorer, right click the project and select “Branching and Merging …” and then select “Convert to branch”
On your PC create a new empty folder.
Open a command prompt, and use the git-tfs utility to create a new local git repo of your TFS project:
C:\ts\temp> git-tfs clone -d http://yourtfsserver:8080/tfs/yourcollection/ "$/pathtoyourbranch" .
Where http://yourtfsserver:8080/tfs/yourcollection/ is the URL of your TFS collection.
Where $/pathtoyourbranch is the source location of your branch within TFS (get from Source Code Explorer)
Then connect this to your VSTS repo:
C:\ts\temp>git remote add origin https://your.visualstudio.com/xyz/_git/yourrepo
Where https://your.visualstudio.com/xyz/_git/yourrepo is the URL of your new git repo in VSTS.
And push to the repo with this command:
C:\ts\temp>git push -u origin --all
Your code is now uploaded.