简体   繁体   English

Visual Studio 2019-如何添加Git远程

[英]Visual Studio 2019 - How to add Git remote

I already have a git repostory setup that is empty. 我已经有一个git repostory设置为空。 I want to push my local changes to this remote repository but I can't figure out how to add the remote repository. 我想将本地更改推送到该远程存储库,但是我不知道如何添加远程存储库。 If this was Azure there would be a wizard but it's not so you have to understand the little hidden items to click on to get where you need to go. 如果这是Azure,将有一个向导,但不是,因此您必须了解要单击的小隐藏项目才能到达所需的位置。

Anyway, I found that I can drill into Repository settings and I see a tiny link under remotes called add , if I click it, it looks like I can add a repository but It's asking me a question I I'm not sure about. 无论如何,我发现我可以深入到“存储库”设置中,并且在遥控器下看到一个名为add的微小链接,如果单击它,似乎可以添加一个存储库,但是它在问我一个我不确定的问题。 It wants to know fetch and push urls. 它想知道获取和推送URL。 Do I put the same url for both? 我是否为两个网址都输入了相同的网址? I swear I've done this before in the past but I don't remember inputting the url in twice. 我发誓我以前曾经做过此事,但我不记得两次输入该网址。

Here is the prompt: 这是提示: 在此处输入图片说明

Just paste the url within the Fetch, it will automatically also copy it to the below Push input because the checkbox below is checked. 只需将网址粘贴在提取中,由于选中了以下复选框,它也会自动将其复制到下面的Push输入中。

If you've already saved and committed changes locally and want to push them to the new repository then open command prompt from root of project folder and do the following: 如果您已经在本地保存并提交更改,并且想要将其推送到新的存储库,则从项目文件夹的根目录打开命令提示符,然后执行以下操作:

git push -u <'Name' you used in picture above> master

You only have to run this command the first time so that the branch will track the remote brach. 您只需要第一次运行此命令,以便分支机构可以跟踪远程分支。 Afterwards you can use the Sync Push link within Visual Studio. 之后,您可以使用Visual Studio中的“ Sync Push链接。

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

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