This issue is not the same as git - how to mirror file from other repo or How do I update my bare repo?
Since a repository cloned with --mirror
is a bare repository, can I make a repository cloned with --bare
be like one cloned with --mirror
? Can it be done by simply modifying the config file?
If not, is there other method which can convert a bare repository to a mirror repository?
Another question, Why can I not use git push --all in a mirror repo, while this command can be ran in a bare repo?
To change a repository cloned with git clone --bare
into one that matches what it would be with a git clone --mirror
, do the following:
$ git config remote.origin.fetch "+refs/*:refs/*"
$ git config remote.origin.mirror true
Then do a git fetch
and everything should be up-to-date.
If you have clone your repo with git clone --mirror
, then a git push --all
, following the default matching
push policy, will push all local branches to the remote repo.
But if your remote repo has been added to your local repo as a remote reference (ie your local repo has been cloned from another remote repo), then a git push --all secondRemoteRepo
won't find many matching branch to push to, unless you fetch those branches first.
So this should work:
git fetch secondRemoteRepo
git push --all secondRemoteRepo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With