The problem is a simple one. I've used git cvsimport to import a cvs repo into a remote branch in a local git repository. I then wish to sync this repository: branches, tags, and all, to a git repository in the cloud (github / gitorious). To do this I don't have the access to rsync or copy the repository directly, I have to use git push.
How do I go about mirroring my local repository so others have access to the full _cvsimport_d history?
Concretely:
I import and track a repository using cvsimport:
git cvsimport -i -v -C cdt-make-core -d :pserver:[email protected]:/cvsroot/tools -r cvs org.eclipse.cdt/all/org.eclipse.cdt.make.core
The above imports org.eclipse.cdt.make.core into the remote cvs in the git repo cdt-make-core.
I can then push the HEAD of the main CVS branch to github:
git push github cvs/master:refs/heads/cvs/HEAD
(I specify the path on the remote explicitly so if it doesn't exist it's created.)
Is there any way to sync all the branches: cvs/* => cvs/* on the remote?
Is there any way to sync all the tags?
To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.
Push a new Git branch to a remote repo Clone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch.
You first have to get the original Git repository on your machine. Then, go into the repository. Finally, use the --mirror flag to copy everything in your local Git repository into the new repo.
I think you're looking for the --mirror
option to push:
git push --mirror github
This will push all refs (branches and tags) including non-fast-forward updates. I use this for creating backups of my local repository.
The man page describes it like this:
Instead of naming each ref to push, specifies that all refs under
$GIT_DIR/refs/
(which includes but is not limited torefs/heads/
,refs/remotes/
, andrefs/tags/
) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end. This is the default if the configuration optionremote.<remote>.mirror
is set.
[OT: I use CDT in my everyday work and I love it!]
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