Git push fails with authorization issue

已回答

When i try to push my local changes to the remote repository every day the first push from the Commit pane of IntelliJ fails with an “unauthorized” error. When i open a command line in the terminal and execute the push from there it is successful. After that, subsequent pushes from the Commit pane are executed successful too. I'm working against acompany internal Gitea repository and use the credential helper. What can i do to fix this annoying issue?

Kind Regards

Andreas

0

Do you have the option - File | Settings | Version Control | Git | Update | Use credential helper enabled?

So the remote repository is hosted on a local internal server in your company's network? Did you have any issues cloning the repository using the IDE actions, or fetching/pulling changes from the remote branches?

Could you please enable debug logging by adding the following lines to Help > Diagnostic Tools > Debug Log Settings..:

git4idea.commands.GitHandler
output.git4idea.commands.GitHandler

restart IDE, reproduce the issue again and share your IDE logs (Help > Collect Logs and Diagnostic Data)?
Logs contain useful information about your environment and potentially some errors/exceptions related to the issue.

You can upload the log archive file here: https://uploads.jetbrains.com, just provide the uploaded file ID. The uploaded files are accessible to the JetBrains team only. Thank you!

0

I have uploaded the logs along with my git configuration and IntelliJ settings. The Upload id is 2026_05_13_kR6Dz8b7x7vrpq9C76GKNE. Before starting IntelliJ and collecting the logs i deleted the content of the log folder to omit unrelated stuff.

My IntelliJ version is (but the problem occurs also in 2026.2 EAP 1):

IntelliJ IDEA 2026.1.1
Build #IU-261.23567.138, built on April 23, 2026
Source revision: a789291cd24df
Licensed to Andreas Seibt
Subscription is active until August 8, 2026.
Runtime version: 25.0.2+1-b329.117 amd64137.0.17-261-b81
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
Exception reporter ID: 2210241c4285258-dc94-470f-98e7-dbeb9deb90b5
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 16
Registry:
 debugger.new.tool.window.layout=true
 ide.experimental.ui=true
 ide.slow.operations.assertion=false
 jdk.updater=false
 trace.state.event.service.url=https://api.jetbrains.cloud/trace-status
 llm.chat.default.agent.rollout.enabled=true
 terminal.new.ui=true
Non-Bundled Plugins:
 ru.adelf.idea.dotenv (261.23567.176)
 org.jetbrains.completion.full.line (261.23567.182)
 com.intellij.spring (261.23567.176)
 com.intellij.properties.bundle.editor (261.0.0)
 Rider UI Theme Pack (0.15.4-hotfix)
 com.anthropic.code.plugin (0.1.14-beta)
 com.intellij.spring.debugger (261.23567.28)
 org.jetbrains.plugins.workspace (261.23567.28)
 com.intellij.ml.llm (261.23567.193)
 org.jetbrains.jumpToLine (0.1.20)
 org.jetbrains.plugins.hocon (2026.1.2)
 MavenRunHelper (5.0.0-IJ2025.1)
 com.intellij.exposed (261.22158.182)
 org.mapstruct.intellij (1.9.1)
 com.nbadal.ktlint (0.30.4)
 kotest-plugin-intellij (6.1.13-261-EAP-SNAPSHOT)
 io.k6.ide.plugin (1.6.0)
 zielu.gittoolbox (600.2.6+253)
 org.jetbrains.plugins.node-remote-interpreter (261.23567.143)
 com.intellij.mcpServer (261.23567.174)
 org.sonarlint.idea (12.2.2.84629)
 io.kotzilla.koin (1.5.3)
Kotlin: 261.23567.138-IJ
 

0

Thank you for the information and logs.

It looks like credential helper delegation is enabled in the IDE. So the authentication should be handled by the git credential helper.
When you push to the remote repository using the command line (outside of the IDE), do you get some kind of credentials prompt?

Does it help to clear the stored credentials in Windows Credential Manager for the relevant remote URL, and pushing once again from the command line to re-cache the credentials?

Also, are you using the same git (installation) executable in your command line and in the IDE (Settings (⌘ + , or Ctrl + Alt + S) > Version Control > Git > Path to Git Executable)?

0

Same problem here. I can push via Git Bash, but I can’t through IntelliJ. The token login method is timing out too. My IntelliJ doesn’t have any extensions installed.

0

Andersonadm1314 

Does the push operation work from the IDE when you run it in git bash – like in the initial description of this post? Or it fails consistently in the IDE?
Are other remote operations like pull/update/fetch working correctly from the IDE, or do they fail as well?
Which error message do you receive when you try to push via IDE?

Could you please enable debug logging by adding the following lines to Help > Diagnostic Tools > Debug Log Settings..:

git4idea.commands.GitHandler

restart IDE, reproduce the issue again and share your IDE logs (Help > Collect Logs and Diagnostic Data)?

You can upload the log archive file here: https://uploads.jetbrains.com, just provide the uploaded file ID. The uploaded files are accessible to the JetBrains team only. Thank you.

0

It’s an authentication error. I try to log in, but I always end up getting a timeout. I can’t authenticate even after creating a new token. I can authenticate normally outside IntelliJ and in other IDEs, only IntelliJ is failing. I even updated my IDE to see if it would fix the issue, but the problem still persists.

0

Never mind, I just tried again and it connected through the IDE. Now I’m curious about what might have happened 😵‍💫

0

Andersonadm1314 
Thank you for the information. It sounds like there could be some network connection issues. Do you use a proxy to connect to the internet? If yes, you can check if it is correctly configured in the IDE settings – File | Settings | Appearance & Behavior | System Settings | HTTP Proxy.

For GitHub/GitLab repositories, the IDE is trying to authenticate via OAuth or PAT (personal access token) while the command line git is using regular http(s) or ssh authentication.

0

Yeah, I thought that could be it too, so I turned off the proxy before trying to log in again, but it still kept timing out. I’ll take a look at my network tomorrow. Thanks for taking the time to look into this, Ivan!

1

Ivan Pajic 

This morning i pushed some changes with IntelliJ 2026.2 EAP 2 with the same behavior as described in my initial post. Then i changed to IntelliJ 2026.1.2 and pushed some other changes without having credentials problems. Then i deleted the credentials in the Windows settings. Another push (with IntelliJ 2026.1.2) succeeds without errors and after the push the credentials are stored again in the Windows settings. So it seems to be a problem just after WIndows startup.

0

Thank you for the information.

It sounds like there is indeed some problem with the stored credentials in the Windows Credential Manager.
A workaround could also be to disable the option – File | Settings | Version Control | Git | Update | Use credential helper and enable: File | Settings | Appearance & Behavior | System Settings | Passwords | In KeePass. IDE will not use the git credential helper for storing the credentials in this case, but it will use the IDE's embedded credentials store – KeePass.

0

Ivan Pajic 

Not using credential helper solves my problem. But I have a hint: Last time when the authorization failed, i tried to push a branch which has no upstream. And I think, the pushes which failed inthe past also had no upstream.

Kind Regards

Andreas

0

Thank you for the update. Glad to hear it helped to work around the issue.

But I have a hint: Last time when the authorization failed, i tried to push a branch which has no upstream. And I think, the pushes which failed inthe past also had no upstream.

I don't think you would receive the Unauthorized error in case of missing an upstream branch.

0

请先登录再写评论。