To facilitate multiple users or several GitHub accounts using the IntelliJ IDE, you need to follow these steps:
- Open IntelliJ IDEA and go to File -> Settings.
- Navigate to Version Control -> GitHub.
- Click on the “Add Account” button.
- In the “Login to GitHub” window that appears, enter the username and password of the GitHub account that you want to add.
- Click on the “Login” button to authenticate.
- Once you’ve successfully added the account, you can use it to create or clone repositories from within IntelliJ IDEA.
To switch between accounts:
- Select your project in the “Project” view.
- Right-click on the project and navigate to “Git” -> “Repository” -> “Configure Git Repository”.
- Switch to the “Remotes” tab.
- Add a new remote with a different name (e.g. “origin2”) and the URL of the repository you want to use.
- Go back to the main menu and select “VCS” -> “Git” -> “Fetch” to update the repositories.
- Finally, switch to the new remote by selecting “VCS” -> “Git” -> “Branches…” and selecting the relevant branch from the dropdown menu.