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"'
{
"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"
}
]
}
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"
}
]
}
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"
}
]
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Anukriti Gupta I am also facing the same issue, did you get a solution for the creating new file issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.