7

I created a new Team Project on Visual Studio Online that I have connected to in Visual Studio 2013. Using the IDE, I cloned a local Git repo (that was pulled down from GitHub) into the Local Git Repositories section.

When I went through the documentation on Visual Studio's website, it showed an option to "Publish to {Team Project}."

enter image description here

Mine doesn't show this:

enter image description here

And it looks like this has been a problem in the past (others have needed to change the .git/config file). Has this been fixed yet so I can use the IDE completely? Or am I missing something?

Community
  • 1
  • 1
m00nbeam360
  • 1,357
  • 2
  • 21
  • 36
  • You need to connect to a Team Project that has a Git repository, only then can Visual Studio show the publish option. I suspect you also need to add TFS as remote to the local repository by editing the config file or by using the git commandline `git remote remove` and `git remote add`. – jessehouwing Jan 02 '14 at 19:45

2 Answers2

8

The answer marked as correct doesn't appear to be correct. To push an existing local repo to a VSO repo involves following:

git remote add origin https://<NAME>.visualstudio.com/DefaultCollection/_git/<PROJECT> git push -u origin --all

This assumes you've already created <PROJECT> in VS Online as a new team project using Git as the source control strategy.

x0n
  • 51,312
  • 7
  • 89
  • 111
  • I have created a project on VSO and when I run the second command it gives an error "TF401019: The Git repository with name or identifier VSCodeDemo does not exist or you do not have permissions for the operation you are attempting." – Ali Shahzad Apr 13 '17 at 12:55
6

This publish option is only shown when you are connected to a Team Project and when the remote uri of the git repository is set to the TFS uri.

To fix this you can manually edit the git files, but I tend to open the Git Command Prompt (right-click the repo and choose Open Command prompt.

On the command line enter:

git remote set-url origin http://[server]:[port]/tfs/[projectcollection]/_git/[ProjectName]

git pull

[[ resolve any merge issues ]]

git push

Community
  • 1
  • 1
jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • Thanks, jessehouwing. I actually have used Command Prompt to add a remote (it also works to solely use the command-line to pull down the GitHub repo directly then push the changes), but wasn't sure if VS2013 finally supported the migration all in the IDE :( – m00nbeam360 Jan 02 '14 at 20:06