Git fails to push to remote configured as mirror
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
Problem
Pushing to a git repository that has been configured as a mirror does not work, reporting an error like this:
1
error: --mirror and --tags are incompatible
Cause
You created the remote outside of SourceTree with the --mirror=push option. This forces git to add --mirror to the command line which is incompatible with some more specific options, such as --tags, which SourceTree uses to push tags by default.
Workaround
The --mirror=push remote configuration is really a convenience for the command-line so you don't have to type as much; since SourceTree is more specific about how to push this is going to conflict. Unfortunately git provides no way to override the forced --mirror option so effectively this remote is not usable with SourceTree. Please create another remote pointing to the same location without the forced --mirror option (for example, create it inside SourceTree), or remove this option from the remote in your .git/config .
You should not need the --mirror option with SourceTree anyway since it defaults to selecting your tracked branches in the push dialog, and reducing typing is not an issue.
Was this helpful?