Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Restriction on file path URL length for bitbucket API

blackstonevmwareteam March 19, 2019

I am using below API to add new file to bitbucket server. I am getting below error. Do we have any restriction on file path length and how to overcame this error ?

 

API: http://{{server}}:7990/rest/api/1.0/projects/{{project}}/repos/{{repo}}/browse/Automation-Software/JBoss 71 Enterprise Application Platform - VMware Sample/software-component/JBoss 71 Enterprise Application Platform - VMware Sample-manifest.json

Error:

{
"errors": [
{
"context": null,
"message": "'C:\\Program Files\\Git\\cmd\\git.exe add -- Automation-Software/JBoss 71 Enterprise Application Platform - VMware Sample/software-component/JBoss 71 Enterprise Application Platform - VMware Sample-manifest.json' exited with code 128 saying: error: open(\"Automation-Software/JBoss 71 Enterprise Application Platform - VMware Sample/software-component/JBoss 71 Enterprise Application Platform - VMware Sample-manifest.json\"): Filename too long\nerror: unable to index file 'Automation-Software/JBoss 71 Enterprise Application Platform - VMware Sample/software-component/JBoss 71 Enterprise Application Platform - VMware Sample-manifest.json'\nfatal: adding files failed",
"exceptionName": "com.atlassian.bitbucket.scm.CommandFailedException"
}
]
}

 

Regards

Uttam Agarwal

 

1 answer

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2019

Hello Uttam,

Thank you for providing the exact response you’re getting with the error you have, this is extremely useful. Using the API to upload files is typically very straight forward to use and get working. 

From reviewing the error, it is clearly stating “Filename too long.” There is a limit of 260 characters or fewer for filenames/paths. There is however a workaround which may help to move past this error.

Workaround:

To resolve this issue, please run the following command from GitBash or the Git CMD prompt:

git config --system core.longpaths true

Source documentation: Git checkouts fail on Windows with "Filename too long error: unable to create file" errors

Please attempt the workaround above and let us know the results.

Regards,
Stephen Sifers

blackstonevmwareteam March 22, 2019

Hi Stephen,

Thanks for the response. This will work in system git bash. How this will work in API request.

Regards,

Uttam Agarwal

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events