How to connect my GitHub Enterprise Account with Visual Studio Code

Viewed 8566

I want to know if it's possible to connect my github enterprise account of my organization to vs code, and if so how?

I know how to sign in with a normal github account on vs code but it doesn't work for github enterprise. I already looked up online but couldn't find any answers.

In the vs code settings there is an option called github enterprise: Uri. I put there the url of my github organization "github.organizationname.com" but I don't know what else I need to do.

3 Answers

Here's what worked for me on vs code 1.62.3.

  1. Clone the GitHub Enterprise repo outside of vs code (ie, using git cli in a terminal or GitHub Desktop).

  2. In vs code, open the folder containing the cloned repo.

  3. And just like magic, it works. If you click on the source control tab in vs code, you can pull changes and make commits. Actually, it might not work quite yet if your cloned project doesn't have your personal access token saved. If you need to do that, you can find instructions in this answer to a different question

It is possible to login using GitHub enterprise from VS Code without using personal access token or SSH keys. User can login by SSO if session already exist in browser else will need to sign in using their credentials. One of the ways to achieve this is to install Git Credential Manager. Git Credential Manager (GCM) is a secure Git credential helper built on .NET that runs on Windows, macOS, and Linux.

Compared to Git's built-in credential helpers (Windows: wincred, macOS: osxkeychain, Linux: gnome-keyring/libsecret) which provides single-factor authentication support working on any HTTP-enabled Git repository, GCM provides multi-factor authentication support for Azure DevOps, Azure DevOps Server (formerly Team Foundation Server), GitHub, Bitbucket, and GitLab.

For installing GCM based on OS follow the given link: https://github.com/GitCredentialManager/git-credential-manager

Once GCM is installed and you try to clone a repository you will be able to see Enterprise login page. This can be achieved by using other Git Oauth Authorized Apps such as GitHub CLI.

Related