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'll be able to 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.
If you have GitHub Copilot installed, you can add a GitHub account by selecting Add GitHub account to Visual Studio from the GitHub Copilot status icon, even if you haven't signed into Visual Studio with a Microsoft account, work account, or school 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.
Add a GitHub account from the profile card:
If you're not already signed in to Visual Studio, select the Sign in link in the upper-right corner of the Visual Studio environment and use a Microsoft account, work account, or school account to sign in.
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 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.
Your GitHub account will now be present in your profile card.
Enabling 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 > Accounts.
Then, check the box to Include GitHub Enterprise 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.
Adding GitHub Enterprise Managed User (EMU) accounts
You can add your GitHub EMU account if you're already signed into Visual Studio with a Microsoft account, work account, or school account.
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.
You can use the Account Settings dialog to manage your accounts:
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.
Remove an account
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.