Git push to Bitbucket Data Center returns "Pushing requires write access and your access is read-only."

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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 a repository, the following is returned on the command line:

fatal: remote error: Insufficient permissions
You cannot push to <project-key>/<repo-slug>. Pushing requires write access and
your access is read-only.

Environment

Bitbucket Data Center

Diagnosis

The issue can happen while cloning/pushing using HTTPS or SSH.

HTTPS URL

Check if the HTTP access token in use has the appropriate permissions. Learn more about HTTP access tokens.

SSH URL

Ensure an SSH key has been added for the user or the repository, with write access: 

Cause

HTTPS URL

The issue can happen if the HTTP access token doesn't have write permissions and is a read-only token.

SSH URL

The user likely has another SSH key somewhere on the filesystem, that is different from the one added to Bitbucket Server.

Solution

HTTPS URL

Edit the permissions for the token and try the push again.

SSH URL

  • Check the ~/.ssh/ path in your client machine for another SSH public key
  • Add this key in place of the one currently added to the repository or the user profile in Bitbucket


Last modified on Oct 10, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.