3

Whenever I click push files to GitLab, first IDEA prompts me to enter login credentials.

enter image description here

This dialog window always pop up 3 times after clicking OK. login and password are correct. And after that I always get this error message:

enter image description here

Cannot even add remote in IntelliJ:

enter image description here

But I can "git add" and commit changes in IntelliJ.

Edit: The solution is to use https://git-scm.com/docs/git-credential-store. IntelliJ push now works after that.

3 Answers3

4

One possibility is that your password include a special character that must be percent encoded.

Another is that you have the wrong credentials cached in the Windows Credential Manager.

Regarding the remote, and its error message:

 Remote URL test failed: Authentication failed.

You can see in JetBrains/intellij-community/blob/plugins/git4idea/src/git4idea/remote/GitDefineRemoteDialog.java that it does a git ls-remote

So double-check first what a git ls-remote https://... returns: it should pick your credentials in the credential helper.


As mentioned above, a credential manager issue was the cause.

git config credential.helper

IntelliJ should use the IntelliJ Platform Credentials Store API.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • There is no any special characters in my password. As for windows credential manager, there is no credential manager saved. I can git add and commit changes in IntelliJ but cannot push files to GitLab. – Daryll David Dagondon Oct 19 '17 at 07:49
  • @DaryllDavidDagondon I have edited my answer. Did you try in command line a git ls-remote https://... as I now suggest in my revised answer? What version of Windows, IntelliJ and Git are you using? Are you using your gitlab.com username and password? – VonC Oct 19 '17 at 11:24
  • IntelliJ is 2016.3.7. git version 2.14.2.windows.3. Windows 7 Ultimate. Git ls-remote, git push and git pull works in Git Bash. git ls-remote returns 3 hexes. What is in git ls-remote? – Daryll David Dagondon Oct 20 '17 at 00:53
  • @DaryllDavidDagondon `git ls-remote` is a way to check you can query a remote repo without having to clone it: https://git-scm.com/docs/git-ls-remote – VonC Oct 20 '17 at 04:28
  • @DaryllDavidDagondon If it works in a bash, try to launch your IntelliJ from a CMD where you set first a simplified path: https://stackoverflow.com/a/46777994/6309 – VonC Oct 20 '17 at 04:30
  • It now works after I followed https://git-scm.com/docs/git-credential-store – Daryll David Dagondon Oct 21 '17 at 01:03
  • @DaryllDavidDagondon Great. A credential helper issue as I mentioned. – VonC Oct 21 '17 at 04:15
3

Git add and git commit are local operations, they need no password. A password is required for operations with remotes only - push, pull, ls-remote.

Does it work if you try pushing from the command line?

Also, it is worth checking the logs to find the exact error reason, This could be not only a wrong password but some other underlying error.

Dmitrii Smirnov
  • 7,073
  • 1
  • 19
  • 29
3

The solution is to use https://git-scm.com/docs/git-credential-store. IntelliJ push now works after that.