- 
    
Bug
 - 
    Resolution: Fixed
 - 
    
Medium
 - 
    9.0.0
 
- 
        2
 - 
        Severity 2 - Major
 - 
        
 - 
        RtB - Service ops & Tech entropy
 
Issue Summary
As of Bitbucket 9.0, usage of the old style Git remotes for mirrors that contain the namespace component result in failures to push via the mirror. Git clone and fetch are unaffected.
This change looks to be somewhat intentional, however results in inconsistent and surprising behaviour, plus is not published in the Bitbucket 9.0 release notes. This is a significant and breaking change, it needs to be communicated much better than it is, both in product and in the release notes.
Background
Bitbucket Data Center's "Smart Mirrors" supported multiple upstreams; that is they could mirror from multiple sources. The expected configuration being that one mirror could mirror repositories from multiple Bitbucket Data Center instances, or even Bitbucket cloud. This was achieved by adding a namespace to clone URLs (aka Git remotes). For example where a normal SSH clone URL for Bitbucket might look like this:
ssh://git@bitbucket.example.com/myproject/myrepo.git
a namespaced one looks like:
ssh://git@bitbucket-mirror.example.com/mynamespace/myproject/myrepo.git
The namespace tells the mirror which upstream the repository is hosted on, and also provides project/repo name collision avoidance.
In Bitbucket 7.19 support for multiple upstream servers was removed, a given mirror could only mirror from a single Bitbucket Data Center instance. At the same time we updated the Web UI to start providing clone URLs that omit the namespace component, given it was no longer necessary. However URLs that still contain the namespace continued to be supported seamlessly; the namespace component was simply ignored.
Suggested Solution
This is a significant breaking change, essentially all Git clones that people have in their development environment, where the clone was performed prior to Bitbucket 7.19 will be unable to push. I would argue that continuing to ignore the now unnecessary/redundant namespace component of the clone URL is the correct thing to do for the foreseeable future. It is very simple for us to do that, and will avoid massive pain in our userbase.
If the change is something we'd like to push ahead with then I'd suggest:
1) Adding the change prominently in the Bitbucket 9.0 release notes
2) Update the error messages for both failed HTTP and SSH pushes such that it actually says the URL is invalid or contains a now unsupported namespace component. That will reduce support load for both administrators and Atlassian support when the wave of upgrades to Bitbucket 9.4 LTS happens.
Steps to Reproduce
- Setup a Bitbucket mirror
 - Clone using a Git remote URL for the mirror that contains a namespace (will work)
 - Add a commit and push (will fail)
 
Expected Results
Ideally:
- Git pushes should work
 
Or:
- Bitbucket provide a message stating the Git remote URL is invalid
 - The change should be published in the Bitbucket 9.0 release notes
 
Actual Results
Git push via SSH fails with:
$ git push Warning: Permanently added '[bitbucket.example.com]:7990' (RSA) to the list of known hosts. Repository not found The requested repository does not exist, or you do not have permission to access it. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Git push via HTTP fails with:
$ git push fatal: remote error: This repository is a read-only mirror Changes cannot be pushed as this is read-only mirror of repository MYPROJECT/myrepo. Pushes can only be made to the original repository. This is achieved by running this command in your local repository directory: git remote set-url --push origin <original-repository-clone-url> This ensures subsequent pushes are sent to the original repository.
The HTTP error message is also further misleading, because mirrors do via HTTP support automatic redirection.
Workaround
Remove the namespace component from your Git remote. For example, given the following SSH remote URL:
$ git remote -v origin ssh://git@bitbucket-mirror.example.com/mynamespace/myproject/myrepo.git (fetch) origin ssh://git@bitbucket-mirror.example.com/mynamespace/myproject/myrepo.git (push)
run:
git remote set-url origin ssh://git@bitbucket-mirror.example.com/myproject/myrepo.git
- mentioned in
 - 
                    
Page Loading...