Git push returns error code 403 in Bitbucket Server / Data Center
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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 pushing to Bitbucket Server or Bitbucket Data Center, it responds with the error code 403 (Forbidden error).
1
2
3
4
5
$ git push url directory
Cloning into 'directory'...
error: The requested URL returned error: 403 while accessing url
fatal: HTTP request failed
Environment
Tested in Bitbucket Data Center 7.12.1
Applied to Bitbucket Data Center 7.x and 8.x
Diagnosis
Verify the permissions for problematic users at both Global Permissions as well as Project and Repository levels.
Verify the "Allow basic authentication on API calls" under the Authentication method.
Cause
Scenario 1: When users do not have permission to push changes to this repository.
Scenario 2: "Allow basic authentication on API calls" under the Authentication method is disabled.

Solution
Scenario 1: You have permission to see the repository, but not to contribute. You may want to review the project and repository settings.
More info on Using Project permissions and Repo permissions.
Scenario 2: Enabling the "Allow basic authentication on API calls" should resolve this issue.
Was this helpful?