DevLoverUmar
DevLoverUmar

Reputation: 13923

How to publish a project to an existing Github Repo using VS Code

I have a local project on VS code and a private Repository with the same name on Github. Now, when I follow these steps

Step 1

Step 2

Step 3

It says, Github repository alreadt exists as shown in the last image. Please guide me, how to publish to that existing Github Repository. I know a hack as:

  1. Clone that private Repo to my PC.
  2. Copy my new code to that Repo and Sync to set all things up.

But I want to know a proper short way.

Thanks!

Upvotes: 6

Views: 10176

Answers (2)

Hrithik Tiwari
Hrithik Tiwari

Reputation: 141

Click on the source control icon and initialize the repository:

enter image description here

Afterwards, go to the 3 dot menu in the upper right corner of the source control sidebar:

enter image description here

Once you click on Add Remote, you can now add your repository url or github link and give any remote name like origin alpha beta or anything you wish to and get going ... enter image description here

In the similar way you can now remove your old github remote by selecting remove remote and then selecting your other remote which you want to remove

Upvotes: 5

Alessandro Artoni
Alessandro Artoni

Reputation: 103

After you committed, try to push directly. If you don't have a remote setted yet, Visual Studio Code should tell you to which repository you want to push into.

Upvotes: 2

Related Questions