简体   繁体   English

从IDE迁移本地Git仓库到Visual Studio Online

[英]Migrate local Git repo to Visual Studio Online from IDE

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. 我在Visual Studio Online上创建了一个新的团队项目,我在Visual Studio 2013中连接到该项目。使用IDE,我将本地Git仓库(从GitHub下拉)克隆到Local Git Repositories部分。

When I went through the documentation on Visual Studio's website , it showed an option to "Publish to {Team Project}." 当我浏览Visual Studio 网站上的文档时,它显示了“发布到{Team Project}”的选项。

在此输入图像描述

Mine doesn't show this: 我没有说明这一点:

在此输入图像描述

And it looks like this has been a problem in the past (others have needed to change the .git/config file). 看起来这在过去一直是个问题 (其他人需要更改.git / config文件)。 Has this been fixed yet so I can use the IDE completely? 这已经修复了,所以我可以完全使用IDE吗? Or am I missing something? 或者我错过了什么?

The answer marked as correct doesn't appear to be correct. 标记为正确的答案似乎不正确。 To push an existing local repo to a VSO repo involves following: 要将现有的本地仓库推送到VSO仓库,需要执行以下操作:

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. 这假设您已经使用Git作为源控制策略在VS Online中创建了<PROJECT>作为新的团队项目。

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. 只有在连接到Team Project并且将git存储库的远程uri设置为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 . 要解决此问题,您可以手动编辑git文件,但我倾向于打开Git命令提示符(右键单击repo并选择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

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

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