Git credential-store error when saving a Bitbucket Cloud repository
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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.
*Except Fisheye and Crucible
Summary
When trying to link with a Bitbucket cloud repository in Bamboo and choosing the authentication type as Username and Password, a git credential-store error is displayed in the page:
Environment
- Connecting Bamboo with a Bitbucket Cloud repository
- Observed on Windows and Linux
- All Bamboo supported versions
Diagnosis
To get more details of the error in the <BAMBOO-HOME>/logs/atlassian-bamboo.log, you can enable debug logging for the com.atlassian.bamboo.plugins.git
class with type ALL
.
When looking at the atlassian-bamboo.log
, you'll see that the command and path used by Bamboo to authenticate against the Bitbucket Cloud repository has a blank space in the temp folder
path.
DEBUG [https-openssl-nio-8443-exec-8 url: /rest/api/latest/repository/testConnection; user: admin] [GitCommandProcessor] Running in D:\Program Files\Bamboo\temp: ['D:\Program Files\Git\cmd\git.exe' -c credential.helper= -c 'credential.helper=store --file=D:/Program Files/Bamboo/temp/gitCredentials7503534358303087327.tmp' ls-remote https://admin@bitbucket.org/admin/REPO]
DEBUG [10-BAM::PlanExec:pool-13-thread-4] [GitCommandProcessor] Running in /opt/atlassian/bamboo versions/temp: [/usr/bin/git -c credential.helper= -c 'credential.helper=store --file=/opt/atlassian/bamboo versions/temp/gitCredentials8447275709693639222.tmp' ls-remote https://admin@bitbucket.org/admin/REPO]
Cause
When saving a Bitbucket Cloud repository, Bamboo captures the user and password (app password) provided, storing them in the gitCredentials***.tmp
file for authentication purposes. If there's a space in the <BAMBOO_INSTALL>/temp
folder path, Bamboo fails to parse the user and password stored in the gitCredentials***.tmp
folder, resulting in a git credentials store error message.
Solution
Windows
Incorporating a short name for 'Program Files' on Windows
On Windows, it's possible to have a short name without spaces for the Program Files folder:
- Open the command line and navigate to the drive where Bamboo is located.
Execute the following command to detect any existing short names.
dir /x
If 'Program Files' doesn't have a short name, use the next command to create one.
fsutil file setshortname "D:\Program Files" PROGRA~1
- Re-run the dir /x command to verify that the short name was successfully created.
If needed, when running Bamboo as a Service, if the issue persists, make the following changes:
- Open CMD and move to the
<BAMBOO-INSTALL>/bin
directory. - Type Bamboow.exe //ES//Bamboo and hit enter.
- Go to the Java tab and adjust the bamboo install folder Path to PROGRA~1
- Restart Bamboo and monitor its performance.
Linux
Remove any blank space within the <BAMBOO_INSTALL>/temp folder path. For example, rename /opt/atlassian/bamboo versions/temp
to /opt/atlassian/bamboo_versions/temp
.