The situation

Publish an organization repository to GitHub is not the default behavior of VS Code. We start GitHub with an individual account, and we log in as individual within VS Code. That's why default behavior would be individual.

Solution

To publish a repository to one of your organizations in Github, you need to follow the following steps:

  1. Prepare a repository with git init and committed
  2. Create an empty organization repository. If the repository is not empty, you cannot publish your local repository to it. I created an empty sample repository https://github.com/bizchain/sample Empty repository
  3. Run command Git: Add remote... by pressing Ctrl+ Shift+ P, copy and paste the URL of your empty repo, then set a name. This name is any name, and will not impact anything.

Screenshots for your reference

Empty repository

Empty repository

Set a name for your remote, this name is just a name and would not affect anything. In the screenshot, I set a name samples

Empty repository

After naming the Remote, now you can publish your repository to provided URL (remote URL)

Empty repository

Notes

The most common mistake which could lead to not successfully publising the repository is to create a not empty repository. This sounds strange, but it is true for new developers.

In case you want to change the remote, you can run command Git: Remove Remote.

Happy coding!

Brian Cao @ BizChain Vietnam

Cookie Policy

We use cookies to personalize content, to provide social media features and to analyse our traffic. By using this site, you agree to our Cookie Policy.