16

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.

Cicciopasticcio
  • 195
  • 1
  • 2
  • 8
  • 1
    VS Code member here: Since October 2022 GHES auth is supported. Once you open a repo with a GHES remote, the Pull Request extension will guide you to log in with GHES oauth flow. – digitarald Oct 26 '22 at 18:27

4 Answers4

4

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

jpobst
  • 3,491
  • 2
  • 25
  • 24
3

I have set it up in the vscode settings like so: enter image description here

Then it asked for my personal access token. This is token can be created under "settings" -> "developer options" see: https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

Rayee Roded
  • 2,440
  • 1
  • 20
  • 21
  • 2
    When I do this and try to sign in/turn on sync it redirects me to github.com instead of the enterprise instance. Did this not happen for you? I do not get told to provide a token. – Sam Brightman Sep 07 '22 at 11:39
  • 2
    I am actually struggling with this again. it's not promoting me to enter my token (and it should) – Rayee Roded Sep 11 '22 at 11:53
  • Same. It redirects me to github.com instead of the enterprise instance. – ranemak Apr 14 '23 at 14:34
1

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.

0

Another option is to access with you microsoft email and then , the Github enterprise signing option will be added in "Account" just click it and you now will have access to GithubEnterprise

Account bottom in green

more reference here is the link: https://learn.microsoft.com/en-us/visualstudio/ide/work-with-github-accounts?view=vs-2022