The 'Repository is read-only' error in Bitbucket occurs when you try to push changes but lack write permissions. This is typically caused by insufficient access rights, repository archival, account suspension, or hitting storage quotas.
This error indicates that Bitbucket has explicitly blocked write operations to the repository. The server received your push request and authenticated you successfully, but it refuses to accept any changes because the repository is in a read-only state. Unlike permission-denied errors where your credentials may be wrong, this error means Bitbucket recognized who you are but the repository itself is not accepting modifications. The repository could be archived, under maintenance, locked by an administrator, or your account may lack write privileges. Common scenarios that trigger this error include: 1. **Repository archived** - The repository has been archived and is now read-only by design 2. **Insufficient permissions** - Your account has read access but not write access 3. **Workspace storage quota exceeded** - Bitbucket workspaces have storage limits 4. **Account suspension** - Your Bitbucket account or workspace may be suspended 5. **Repository maintenance** - Temporary read-only state during migrations or maintenance 6. **Branch restrictions** - Some branches may be protected from direct pushes
First, verify that you have write access to the repository:
1. Go to the repository on Bitbucket (bitbucket.org)
2. Click Repository settings in the left sidebar
3. Navigate to User and group access
4. Find your username and check your permission level
Permission levels in Bitbucket:
- Read - Can clone and pull only (causes this error)
- Write - Can push to most branches
- Admin - Full access including settings
If you have only Read access, ask a repository administrator to grant you Write access.
# Verify which remote you're pushing to
git remote -v
# Confirm your Bitbucket username
git config user.nameArchived repositories are read-only by design. Check if this is the case:
1. Go to the repository page on Bitbucket
2. Look for an "Archived" badge or banner at the top
3. If archived, you'll see "This repository has been archived"
To unarchive a repository (requires admin access):
1. Go to Repository settings
2. Navigate to Repository details
3. Scroll to the bottom and click Unarchive repository
4. Confirm the action
If you don't have admin access, contact the repository owner to unarchive it.
Alternative: Fork the repository
If the repository should remain archived, you can fork it:
# Remove the old remote
git remote remove origin
# Add your forked repository as the new origin
git remote add origin [email protected]:YOUR_USERNAME/repo.git
# Push to your fork
git push -u origin mainBitbucket workspaces have storage limits. If exceeded, repositories become read-only:
Check workspace storage:
1. Go to your workspace settings on Bitbucket
2. Click Plans and billing or Storage (depending on your plan)
3. Check the storage usage graph
Free tier limits:
- Bitbucket Free: 1 GB soft limit, 2 GB hard limit per workspace
- Over 1 GB: Warning notifications
- Over 2 GB: Repositories become read-only
Solutions:
1. Delete old branches:
# List merged branches
git branch -r --merged main
# Delete remote branches
git push origin --delete feature/old-branch2. Clean up large files:
# Find large files in history
git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '/^blob/ {print $3, $4}' | sort -rn | head -20
# Use BFG Repo-Cleaner to remove large files
# See: https://rtyley.github.io/bfg-repo-cleaner/3. Upgrade your Bitbucket plan for more storage
Your Bitbucket account or workspace may be suspended:
Check account status:
1. Go to [bitbucket.org/account/settings](https://bitbucket.org/account/settings/)
2. Look for any warning banners or notifications
3. Check your email for messages from Bitbucket about account issues
Common suspension reasons:
- Billing issues (expired credit card, unpaid invoices)
- Terms of service violations
- Security concerns (compromised account)
- Inactivity on premium plans
To resolve:
1. Log in to your Atlassian account
2. Go to [my.atlassian.com](https://my.atlassian.com)
3. Check for any pending actions or payments
4. Update payment information if needed
5. Contact Atlassian Support if the issue persists
If your personal account is fine, check the workspace settings:
1. Go to the workspace
2. Navigate to Settings > Plans and billing
3. Resolve any billing or compliance issues
If you're using an app password or access token, it may lack write permissions:
For App Passwords:
1. Go to [bitbucket.org/account/settings/app-passwords](https://bitbucket.org/account/settings/app-passwords/)
2. Check your existing app password's permissions
3. Ensure Repositories: Write is enabled
Create a new app password with correct permissions:
1. Click Create app password
2. Give it a descriptive label
3. Select permissions:
- Repositories: Read, Write
- Pull requests: Read, Write (if needed)
4. Click Create
5. Copy the password immediately (it won't be shown again)
Update Git to use the new app password:
# For HTTPS URLs, update stored credentials
# On macOS:
git credential-osxkeychain erase
host=bitbucket.org
protocol=https
# Press Ctrl+D
# On Windows:
# Open Credential Manager and remove Bitbucket entries
# On Linux:
rm ~/.git-credentials
# Or edit and update the entryThen push again and enter your username and new app password when prompted.
Bitbucket may have branch permissions blocking your push:
Check branch restrictions:
1. Go to Repository settings
2. Navigate to Branch restrictions (under Workflow)
3. Look for rules affecting your target branch
Common restrictions:
- Direct pushes blocked (must use pull requests)
- Only certain users can push to protected branches
- Force push disabled on main/master
Solutions:
Option 1: Push to a different branch
# Create and push to a feature branch instead
git checkout -b feature/my-changes
git push -u origin feature/my-changes
# Then create a pull request to merge into the protected branchOption 2: Request push access
Contact a repository admin to add you to the list of users who can push to the protected branch.
Option 3: Modify branch restrictions (if admin)
1. Go to Branch restrictions
2. Edit the rule for the target branch
3. Add yourself or your team to the allowed users/groups
If HTTPS authentication is causing issues, try SSH:
Set up SSH key for Bitbucket:
# Generate a new SSH key (if needed)
ssh-keygen -t ed25519 -C "[email protected]"
# Start the SSH agent
eval "$(ssh-agent -s)"
# Add your key
ssh-add ~/.ssh/id_ed25519
# Copy your public key
cat ~/.ssh/id_ed25519.pubAdd the SSH key to Bitbucket:
1. Go to [bitbucket.org/account/settings/ssh-keys](https://bitbucket.org/account/settings/ssh-keys/)
2. Click Add key
3. Paste your public key
4. Give it a label and save
Update your remote URL to use SSH:
# Check current remote
git remote -v
# Change from HTTPS to SSH
git remote set-url origin [email protected]:workspace/repo.git
# Test the connection
ssh -T [email protected]
# Try pushing again
git push origin mainIf none of the above solutions work, the repository may be locked at the server level:
Contact repository administrator:
The error message specifically says "Please contact the repository administrator." This means someone with admin access needs to investigate:
1. Identify who has admin access to the repository
2. Ask them to check:
- Repository archive status
- User permissions
- Workspace billing status
- Any recent maintenance or migration
Contact Atlassian Support:
If you're an administrator and still can't resolve it:
1. Go to [support.atlassian.com](https://support.atlassian.com)
2. Select Bitbucket Cloud
3. Describe the issue with:
- Repository URL
- Exact error message
- Steps you've already tried
- When the issue started
Check Bitbucket Status:
The issue might be on Bitbucket's end:
1. Visit [status.bitbucket.org](https://status.bitbucket.org)
2. Check for any ongoing incidents
3. Subscribe to updates if there's an outage
### Understanding Bitbucket's Read-Only States
Bitbucket repositories can become read-only for several infrastructure reasons:
Planned read-only states:
- Repository archival (intentional by admin)
- Workspace migration between regions
- Repository transfer between workspaces
- Storage quota enforcement
Unplanned read-only states:
- Backend storage issues
- Database maintenance
- Disaster recovery operations
### Bitbucket Pipelines and CI/CD Implications
If your CI/CD pipeline uses Bitbucket Pipelines and pushes back to the repository (e.g., version bumps, changelog updates), ensure:
# bitbucket-pipelines.yml
pipelines:
default:
- step:
script:
# Use the built-in Bitbucket Pipelines git push
- git push origin main
# The pipeline's OAuth has write access by default
# Check Settings > Pipelines > Repository variablesFor external CI (Jenkins, GitHub Actions):
- Use dedicated deployment credentials with write scope
- Store credentials securely in CI secrets
- Verify the app password has Repository: Write permission
### Bitbucket Workspaces vs Repositories
Permissions cascade from workspace to repository:
1. Workspace members inherit default permissions
2. Repository permissions can restrict but not exceed workspace level
3. Branch permissions add another restriction layer
If you're an admin at the workspace level but not the repository level, you may still be blocked.
### Git LFS and Large File Storage
Bitbucket has separate quotas for Git LFS:
# Check if LFS is causing issues
git lfs status
git lfs ls-files
# LFS has its own storage limit
# Check: Workspace settings > Git LFSIf LFS quota is exceeded, even small text file pushes may fail.
### API-Based Repository Lock
Bitbucket admins can lock repositories via the REST API:
# Check repository metadata (requires admin access)
curl -u username:app_password \
https://api.bitbucket.org/2.0/repositories/workspace/repo
# Look for "is_private" and any lock indicators in the response### Mirroring and Forked Repositories
If the repository is a mirror or fork with restricted settings:
- Mirrors are typically read-only by design
- Forks may have push restrictions from the parent
- Check if the repository is a mirror: Repository settings > Mirroring
### Recovery from Quota Issues
After resolving storage quota:
1. Wait a few minutes for Bitbucket to update
2. Try pushing a small change first
3. If still failing, contact support - there may be a propagation delay
# Test with a minimal commit
echo "test" >> test.txt
git add test.txt
git commit -m "Test push after quota fix"
git push origin mainkex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server
fatal: unable to access: Proxy auto-configuration failed
How to fix 'Proxy auto-configuration failed' in Git
fatal: unable to access: Authentication failed (proxy requires basic auth)
How to fix 'Authentication failed (proxy requires basic auth)' in Git
fatal: unable to access: no_proxy configuration not working
How to fix 'no_proxy configuration not working' in Git
fatal: unable to read tree object in treeless clone
How to fix 'unable to read tree object in treeless clone' in Git