IntelliJ IDEA GitHub integration creates the repository, but gets “couldn't authorize” error trying to push
I create a new project in IntelliJ IDEA
Via the menu, I go to VCS -> Import into Version Control -> Share project on GitHub
Enter a new repository name and click Share
It authenticates with GitHub ok
When I try to push to GitHub, a login window opens that says "Login to https://firstname.lastname@example.org/GitHubTest2.git"
The default login is github.com/my_username. I try to login with that login and my GitHub.com password and authentication fails. I also try to login with my GitHub.com login (i.e. email@example.com) and my GitHub.com password.
After 3 tries, I get the following error message:
Push to GitHub failed Push authorization failure: Couldn't authorize
Why does it authenticate with GitHub with my GitHub.com login/password but not when it tries to push the project to GitHub?
The following worked for me:
- Instead of using username and password use a personal access token. In GitHub: Go to "Account settings" > "Applications" and generate a "Personal Access Token"
- Go to "Settings" > "Version control" > "GitHub" and enter your login and the generated access token. Now pushing to the GitHub repo should work.