IntelliJ IDEA 2023.2 Help

GitHub

IntelliJ IDEA lets you manage Git projects hosted on GitHub directly from the IDE: clone repositories, share your projects, create forks, share code through gists, create pull requests and review incoming pull requests.

Register a GitHub account

To be able to retrieve data from a repository hosted on GitHub, or share your projects, you need to register your GitHub account in IntelliJ IDEA.

Register an existing account by signing in to GitHub

  1. Press Control+Alt+S to open the IDE settings and then select Version Control | GitHub.

  2. Click the Add button.

  3. Select Log In via GitHub.

  4. Enter your GitHub credentials in the browser window that opens. If you have two-factor authentication enabled, you will be asked to enter a code that will be sent to you by SMS or through the mobile application.

Register an existing account with a token

  1. Press Control+Alt+S to open the IDE settings and then select Version Control | GitHub.

  2. Click the Add button.

  3. Select Log In with Token.

  4. Do one of the following:

    • If you already have a token, insert it in the Add GitHub Account dialog window:

      Adding GitHub account with token
    • If you want to obtain a new token, click Generate.

      Enter your GitHub credentials in the browser window that opens. If you have two-factor authentication enabled, you will be asked to enter a code that will be sent to you by SMS or through the mobile application.

      In the token generation page, make sure that the repo, the gist and the read:org scopes are enabled (refer to Understanding scopes).

      Click Generate token, copy the token, and paste it into the Add GitHub Account dialog window.

  5. Click Add Account

See Creating a personal access token for more details on GitHub tokens.

Update an expired token

  1. When your token expires, you see the following warning when trying to push changes to the GitHub repository:

    Expired token warning

    Click Use Token.

  2. Do one of the following:

    • If you already have a token, insert it in the Log In to GitHub dialog window:

      Adding GitHub account with token
    • If you want to obtain a new token, click Generate.

      Enter your GitHub credentials in the browser window that opens. If you have two-factor authentication enabled, you will be asked to enter a code that will be sent to you by SMS or through the mobile application.

      In the token generation page, make sure that the repo, the gist and the read:org scopes are enabled (refer to Understanding scopes).

      Click Generate token, copy the token, and paste it into the Log In to GitHub dialog window.

  3. Click Log In

Create a new GitHub account

  1. Press Control+Alt+S to open the IDE settings and then select Version Control | GitHub.

  2. Click the Add button.

  3. Select Log In via GitHub.

  4. In the browser window that opens, click Create an account and complete the registration process on GitHub.

  5. Return to the IntelliJ IDEA settings, click Cancel, and then repeat steps 2 and 3.

  6. Click Authorize JetBrains in browser.

Manage multiple GitHub accounts

You can use multiple GitHub accounts in IntelliJ IDEA: for example, a personal account to work on an open-source project, and a corporate account for your main job.

  1. Press Control+Alt+S to open the IDE settings and then select Version Control | GitHub.

  2. Use the add icon button to add as many accounts as you need.

  3. (Optional) To set an account as a default one for the current project, select it and click the Check button. If a default account is set, IntelliJ IDEA will not ask you to select an account you want to use when you share your project on GitHub, rebase a fork, create a pull request, or create a gist.

Last modified: 05 September 2023