简体   繁体   English

连接到TFS或Visual Studio Online中的git存储库

[英]Connect to git repository in TFS or Visual Studio Online

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. 我已经在团队基础服务中创建了一个git存储库,我想连接到它,但我不知道它的URL并且烦人地找不到它。

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. 我在基础服务网站上命名了我的repo myproject.mysubproject。

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. 我尝试了https://mysubdomain.visualstudio.com/myproject.mysubprojecthttps://mysubdomain.visualstudio.com/myproject.mysubproject.git ,但两者都没有雪茄,而且我现在几乎没有想法。 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) 编辑:作为旁注:我不是从视觉工作室工作,我也不想参与这个项目(但我会为其他项目)

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] 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. 另请注意,如果您浏览到该项目代码中心,则它与您的Web浏览器中的URL相同。

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. 对于初始仓库,仓库名称与项目匹配,因此URL中不需要项目名称。 For additional repos, projectName may be required: 对于其他repos,可能需要projectName:

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

But once again, using the web UI is the easiest way to get the url. 但再一次,使用Web UI是获取URL的最简单方法。

Once you have that url you can simply run git clone [url] 一旦你有了这个网址,你就可以简单地运行git clone [url]

edit: 编辑:

For authentication, VSO recently added PAT tokens. 对于身份验证,VSO最近添加了PAT令牌。 You can use any username and the PAT token as the password. 您可以使用任何用户名和PAT令牌作为密码。 See more here This is not available for on-prem TFS yet. 在此处查看更多内容尚未提供给本地TFS。

You can also use Alternate Credentials: see more here 您还可以使用备用证书: 在此处查看更多信息

This has been slightly tweaked in the newer versions of Visual Studio Online. 在较新版本的Visual Studio Online中稍微调整了一下。 Now go to your project, go to "Code", and then (assuming you've already set up a project) there will be a "Clone" button on the far right, hitting that will bring a little popup with the clone url (which is the git url). 现在转到你的项目,转到“代码”,然后(假设你已经设置了一个项目),最右边会有一个“克隆”按钮,点击这将带来一个带有克隆URL的小弹出窗口(这是git url)。 VSO Image VSO图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM