简体   繁体   中英

Visual Studio 2019 - How to add Git remote

I already have a git repostory setup that is empty. 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.

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. It wants to know fetch and push urls. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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