Add your GitHub accounts to your Visual Studio keychain
In this article, you learn how to add your public GitHub or GitHub Enterprise account to your Visual Studio keychain. After you add your account, you can track your code changes in GitHub repositories, right from Visual Studio. You can also create and use GitHub Actions for deployment automation.
Adding public GitHub accounts
You can add your public GitHub account at any point, after you've signed into Visual Studio with a Microsoft account, work account, or school account.
In this article, you learn how to add your public GitHub or GitHub Enterprise account to your Visual Studio keychain. After you add your account, you can use GitHub Copilot and track your code changes in GitHub repositories, right from Visual Studio. You can also create and use GitHub Actions for deployment automation.
Adding public GitHub accounts
You can add your public GitHub account at first launch or later, without needing to sign into Visual Studio with a Microsoft account, work account, or school account. You can add multiple GitHub accounts to the IDE. The first account added becomes the active account, but you can switch the active account to another one at any time. Adding multiple GitHub accounts impacts Copilot, and version control scenarios, as well as general GitHub authentication experiences across Visual Studio.
If you have GitHub Copilot installed, you can add a GitHub account with a Copilot subscription by selecting Sign in to use Copilot from the GitHub Copilot status icon or Sign up for Copilot Free from the chat window, even if you haven't signed into Visual Studio with a Microsoft account, work account, or school account.
Add a GitHub account at first launch
With Visual Studio 17.13, you can now sign in with a GitHub account when you launch Visual Studio for the first time.
If you choose to not sign in with GitHub at first launch, you can add your GitHub account later using the profile card or the Account Settings dialog as follows.
Add a GitHub account from the profile card
Select the Sign in link in the upper-right corner of the Visual Studio environment and sign in with a Microsoft account, work account, or school account or a GitHub account.
Then, follow these instructions to add your GitHub account.
Select the icon with your profile name in the upper-right corner of the Visual Studio environment, select GitHub if you haven't already signed in or Add another account, and then select GitHub.
You'll be redirected to the browser, where you can sign in with your GitHub credentials. After you sign in, you'll get a success window in the browser, and you can return to Visual Studio.
The GitHub account you added will now be present in your profile card. Note that the account you signed in with first is the Active account.
Add a GitHub account from the Account settings dialog
Open the Account Settings dialog by going to File > Account Settings....
From the All Accounts submenu, select + Add to add an account, and select GitHub.
You'll be redirected to the browser, where you can sign in with your GitHub credentials. After you sign in, you'll get a success window in the browser, and you can return to Visual Studio.
Your GitHub account will now be present in the All Accounts submenu.
Open the Account Settings dialog by going to File > Account Settings....
From the All Accounts submenu, select + Add to add an account, and then select GitHub.
You'll be redirected to the browser, where you can sign in with your GitHub credentials. After you sign in, you'll get a success window in the browser, and you can return to Visual Studio.
Your GitHub account will now be present in the All Accounts submenu. This account becomes the Active account.
Switch the active account
You can switch the active account to another signed-in GitHub account from the profile card or the Account Settings dialog.
Switch using profile card
Select the Sign in link in the upper-right corner of the IDE, select ... for the account you want to make the new active account, then select Set as active account.
Switch using Account Settings
Open Account options by clicking ... for the account you want to make the new active account, then select Set as active account.
Enable GitHub enterprise accounts
By default, Visual Studio only has public GitHub accounts enabled. Use the following steps to add a GitHub Enterprise Server account or an account associated with .ghe.com
endpoints.
To enable GitHub enterprise accounts, go to Tools > Options and search for the Accounts options.
Then, check the box to Include GitHub Enterprise Server accounts. The next time you go to your Account Settings and try to add a GitHub account, you'll see options for both GitHub and GitHub Enterprise.
After you enter your GitHub Enterprise server address, select Sign in with your browser. There, you can sign in using your GitHub Enterprise credentials.
To enable GitHub enterprise accounts, go to Tools > Options > More Accounts.
Then, check the box to Include GitHub Enterprise Cloud and GitHub Enterprise Server accounts. The next time you go to your Account Settings and try to add a GitHub account, you'll see options for both GitHub and GitHub Enterprise.
After you enter your GitHub Enterprise URL, select Sign in with your browser. There, you can sign in using your GitHub Enterprise credentials.
Note
To add an account to access github.com
resources, such as github.com/enterprises/*
, follow the steps for adding public GitHub accounts.
Add GitHub Enterprise Managed User (EMU) accounts
You can add your GitHub EMU account as follows:
Manage accounts using the profile card
Select the icon with your initials in the upper-right corner of the Visual Studio environment. Then, select Add another account > GitHub.
You'll be redirected to the browser, where you can sign in with your GitHub EMU credentials.
Manage accounts using the Account Settings dialog
Select the icon with your initials in the upper-right corner of the Visual Studio environment. Open the Account Settings dialog by selecting Account settings or by going to File > Account Settings....
From the All Accounts submenu, select + Add dropdown to add an account, and then select GitHub.
Select GitHub Enterprise on the Connect to GitHub dialog.
Select the icon with your initials in the upper-right corner of the Visual Studio environment. Open the Account Settings dialog by selecting Account settings or by going to File > Account Settings....
From the All Accounts submenu, select + Add dropdown to add an account, and then select GitHub.
Select GitHub Enterprise on the Connect to GitHub dialog.
Note
Ensure you enter your GitHub EMU account credentials (the username has an underscore followed by the company name) on this page.
After you sign in, you'll get a success window in the browser, and you can return to Visual Studio.
Remove an account
To remove an account, select Remove for the account you want to remove from the All Accounts submenu in the Account Settings dialog.
- Select File > Account Settings....
- All Accounts lists all accounts signed into Visual Studio. Select Remove for the account you want to remove.
- Confirm the removal on the dialog that appears.
To remove an account:
Select the icon with your profile name in the upper-right corner of your Visual Studio environment.
Select Remove account for the account you want to remove.
You can also use the Account Settings dialog to remove an account.
Select File > Account Settings....
All Accounts lists all accounts signed into Visual Studio. Select Remove for the account you want to remove.
Confirm the removal on the dialog that appears.
Troubleshooting sign in issues
If you're experiencing issues when adding or re-authenticating GitHub accounts, try the following steps:
HTTP Strict Transport Security (HSTS) issues
Verify that HTTP Strict Transport Security (HSTS) is not enabled for localhost
on your system's default web browser:
- On Microsoft Edge, you can type: edge://net-internals/#hsts and enter
localhost
under the Delete domain security policies section. - On Google Chrome, type: chrome://net-internals/#hsts and enter
localhost
under the Delete domain security policies section.
Run-as issues
Running Visual Studio using an account that doesn't match your signed-in Windows account, may cause issues when adding GitHub accounts to Visual Studio. You may encounter this issue when using 3rd party products that attempt to run Visual Studio elevated.
You can verify the user by following these steps:
- Open the
Task Manager
- Navigate to the
Details
tab - Search for the
devenv.exe
process - Ensure the username for that process matches the signed in Windows Account
To fix this, run Visual Studio as the user you're signed into Windows with, and then add your GitHub account.
Note
Please report a problem if you're still experiencing sign in issues.