Skip to content

Random push authentication error #1953

Description

@pabermod

Hi,

When pushing commits to a remote origin, some times I get a authentication error. If I try again it pushes correctly.

This happens many times.

The error is:

git: 'credential-manager-core' is not a git command. See 'git --help'.
remote: Failed to authenticate user
fatal: Authentication failed for 'REMOTEREPO'
Pushing to REMOTEREPO

Activity

  1. love-linger commented on Dec 4, 2025

    @love-linger
    Collaborator

    credential-manager-core is no longer supported by git. And SourceGit uses credential-manager by default. Which version of git are you using?

  2. self-assigned this
    on Dec 4, 2025
  3. pabermod commented on Dec 4, 2025

    @pabermod
    Author

    I changed to credential-manager and i'm still getting random errors (now without the first line)

    remote: Failed to authenticate user
    fatal: Authentication failed for 'REMOTEREPO'
    Pushing to REMOTEREPO

    My git version is:

    git version 2.51.0.windows.1

  4. love-linger commented on Dec 4, 2025

    @love-linger
    Collaborator

    remote: Failed to authenticate user is a message from remote, and authorization is not handled by SourceGit (as I said above, SourceGit just tell git that credential-manager will used to do authorization jobs in communication with remote).

    When you directly use git in command line, is it impossible to reproduce this issue?

  5. pabermod commented on Dec 4, 2025

    @pabermod
    Author

    Hi,

    I'm using gitea and I have found this:

    https://techoverflow.net/2025/05/24/gitea-how-to-fix-authentication-failed-but-works-when-trying-again/

    I think the problem may come from this.

    I think if I use a ssh key instead of oauth2 i won't have this problem, right?

    Maybe SouceGit should retry once to force refresh the token? (Or check the expiration of the token and refresh it before pushing (for example if the token will expire in the next 30 seconds)

  6. love-linger commented on Dec 4, 2025

    @love-linger
    Collaborator

    When error occurs, SourceGit can not know what's the output message means...

    For example, the remote may returns fetch first error, which means you should fetch remote first and then rebase your changes and then retry push.

    For most conditions, always retrying is not a right way.

  7. pabermod commented on Dec 4, 2025

    @pabermod
    Author

    You are right, you don't know why authentication failed.

    The problem is with git credential manager. They have a PR open to auto refresh the token:

    git-ecosystem/git-credential-manager#1837

    I'll use an SSH key for now.

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

need-more-infoExtra information or replay is needed

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions