I want to use a repo on a remote git service as a backup for a locally created repo. The remote service is namely Bitbucket, but the question can apply to others.
I can't create a bare repo on Bitbucket (or can I?) so I don't know how to work with 'push --mirror'.
Pushing all branches and commits is sort of ok, but we want to push as much more as possible, such as: tags, remote pointers, remote branches - so that if we clone back downstream, we get a clone that is close enough to the original local repo without the need for too much re-wiring.
We are not concerned about uncommitted work or the working directory or staging area. The workflow is to do a commit then follow by a push to the backup.
We are not seeking a perfect clone that covers working and staging areas. Also we are not seeking a bullet proof backup, I understand that branches can be deleted on local and lost on remote. So basically this is about an easy way to do a partial backup to a service that is already there and providing free private accounts - which provides some level of redundancy and thus some piece of mind.
How can I achieve the above.
First Edit:
This is a log of first trial - not what I expected from my all-local tests, but this in what I'm getting:
- create repo on Bitbucket:
https://shishani@bitbucket.org/shishani/test1.git
- local session
$ git remote add bbtest1 https://shishani@bitbucket.org/shishani/test1.git $ git status # On branch master nothing to commit (working directory clean) $ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/master $ git remote -v bbtest1 https://shishani@bitbucket.org/shishani/test1.git (fetch) bbtest1 https://shishani@bitbucket.org/shishani/test1.git (push) origin /more/coding/git-tests/test-orig (fetch) origin /more/coding/git-tests/test-orig (push) $ git push --mirror bbtest1 Password: fatal: remote part of refspec is not a valid name in :capabilities^{} fatal: The remote end hung up unexpectedly
Any idea what's going on ?!
Second Edit:
I forked a separate question for the unexpected error message here: fatal: remote part of refspec is not a valid name in :capabilities^{}