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

Getting 500 on using Edit File BitBucket Data Center API

Anukriti Gupta December 2, 2022

Curl:

curl --location --request PUT 'https://xyz-on-prem.mycom-beta.com/rest/api/latest/projects/IS/repos/new-repo/browse/newFile.txt' \

--header 'Authorization: Basic YWXXXXXXXXXXXXXXXXXXX==' \

--header 'Cookie: BITBUCKETSESSIONID=FXXXXXXXXXXXXXX' \

--form 'branch="main"' \

--form 'content="new file content"' \

--form 'message="Added new file"'
Hi, I am getting 500 on using BB Data Center API when I am trying to create a new file with commit using Edit File API.
I am getting the following error:
{

"errors": [

{

"context": null,

"message": "'/bin/git cat-file -t cbb0fc3bdedeeda8f8d9eaaaa8fc7644f93ec8ae:newFile.js' exited with code 128 saying: fatal: path 'newFile.js' does not exist in 'cbb0fc3bdedeeda8f8d9eaaaa8fc7644f93ec8ae'",

"exceptionName": "com.atlassian.bitbucket.scm.CommandFailedException"

}

]

}

1 answer

0 votes
Anukriti Gupta December 2, 2022

When I am sending sourceCommitId as null in form body, I am getting the following error:

I want to create a new file, so that's obvious that newFile.js won't exist.

 

{

"errors": [

{

"context": null,

"message": "newFile.js could not be edited because the file has been deleted on the null branch.",

"exceptionName": "com.atlassian.bitbucket.content.NoSuchPathException"

}

]

}
Anukriti Gupta December 2, 2022

One more issue I am facing is that, I am not able to use Access Token to authorize the request. When I am using Access token, I am getting this error while for other APIs, it is working fine.

{

"errors": [

{

"context": null,

"message": "When performing an edit, the author must have an e-mail address.",

"exceptionName": "com.atlassian.bitbucket.validation.ArgumentValidationException"

}

]

}
apuligundla
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 19, 2023

@Anukriti Gupta I am also facing the same issue, did you get a solution for the creating new file issue

Anukriti Gupta April 19, 2023

Yes @apuligundla

The issue was that the Git version installed on our server was not compatible with the Bitbucket Data Center version.

Please find the compatibility details here: https://confluence.atlassian.com/bitbucketserver076/supported-platforms-1026535721.html

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events