Connect to git repository in TFS or Visual Studio Online

Martijn picture Martijn · May 30, 2013 · Viewed 29.3k times · Source

I have created a git repository at team foundation services, and I want to connect to it, but I don't know its URL and annoyingly can't find it.

I created my local repo and dit my initial commit

Now I wonder what remote I should set. I named my repo myproject.mysubproject on the foundation services website.

I tried https://mysubdomain.visualstudio.com/myproject.mysubproject and https://mysubdomain.visualstudio.com/myproject.mysubproject.git, but for both, no cigar, and I'm pretty much out of ideas now. Does anyone know where I will be able to find the repo?

Edit: As a side note: I'm not working from visual studio, nor do I want to for this project (but I will for other projects)

Answer

bryanmac picture bryanmac · May 30, 2013

If you go to the web UI, under the "code" hub, if it's empty repo, the clone url will be there. If it's not empty there is an icon to the right (double paper icon) that will drop down with the clone url.

The url will be in the form ...

https://[youraccount].visualstudio.com/DefaultCollection/_git/[gitRepoName]

Also note that it's the same URL that's in your web browser if you browse to that projects code hub.

However, note in the last release, we added multiple repos per project. For the initial repo, the repo name matches the project so project name isn't required in the url. For additional repos, projectName may be required:

https://[youraccount].visualstudio.com/DefaultCollection/[projName]/_git/[gitRepoName]

But once again, using the web UI is the easiest way to get the url.

Once you have that url you can simply run git clone [url]

edit:

For authentication, VSO recently added PAT tokens. You can use any username and the PAT token as the password. See more here This is not available for on-prem TFS yet.

You can also use Alternate Credentials: see more here