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
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
Hi Stephen,
Thanks for the response. This will work in system git bash. How this will work in API request.
Regards,
Uttam Agarwal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.