Git fails to push to remote configured as mirror

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Pushing to a git repository that has been configured as a mirror does not work, reporting an error like this:

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.

Last modified on Mar 30, 2016

Was this helpful?

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