Getting intermittent authentication problem with BitBucket Server while doing git clone or git pull.


アトラシアン コミュニティをご利用ください。


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く


While trying to clone a repository, there is an authentication failed response 2-3 times without getting prompted for the credentials.

git clone
Cloning into 'test-demo'
fatal: Authentication failed for ''

After that, it is prompted to enter the credentials and the clone works fine.


Bitbucket Server/ Data Center version 7.6 + and above


The atlassian-bitbucket.log, shows similar log entries for the authorization failure.

2022-06-10 11:25:18,498 INFO  [http-nio-7990-exec-925] @KXZGRTx685x337794699x2, "GET /scm/~test/test-demo.git/info/refs HTTP/1.1" c.a.c.m.a.ApplicationServiceGeneric Invalid credentials for user TestUser in directory mydirectory (262145), aborting

Once the git debug logging is enabled, we can see similar lines for the event of the failure.

15:15:07.021513 run-command.c:666       trace: run_command: 'git credential-store get'
15:15:07.024304 git.c:455               trace: built-in: git credential-store get
15:15:07.024664 http.c:756              == Info: Couldn't find host in the .netrc file; using defaults

If you want to compare, you can see the below entries when the try is successful. 

15:18:27.440380 run-command.c:666       trace: run_command: 'git credential-store get'
15:18:27.442953 git.c:455               trace: built-in: git credential-store get
Username for '': TestUser
Password for '': 
15:18:34.966706 http.c:756              == Info: Couldn't find host in the .netrc file; using defaults


Here the git-credential store is the reason for the failure. Once a password gets stored in it, it remains there and those credentials are used for the user authentication for git operations. There could be password policies set in the organization that will force you to change your passwords in a couple of months. But since the wrong password is already stored in the git-credential store, you will be getting the authentication error.


Unset the git the credential helper using the below command before running a git pull/clone. This should be a one time activity. 

git config --unset credential.helper

If this doesn't fix the issue, try unsetting it globally using the below command.

git config --global --unset credential.helper

The people who have used the credential.helper tend to miss the convenience of it and will need to enable it again with the correct password. (smile)  You can run the below command for that before you run any git command.

git config credential.helper store
最終更新日 2022 年 9 月 15 日


Powered by Confluence and Scroll Viewport.