Pages

Friday 28 November 2014

Git mirror without cloning

What I want to do is to set up a bare mirror git repository without fetching the changes. It should be a fast operation compared to:
git clone --mirror $REPOURL
Here are the steps that I did to achieve the same results as a full clone:
# Create and update with the clone command
git clone --mirror https://github.com/matelakat/vimide vimide-with-clone
cd vimide-with-clone/
git fetch
cd ..
And let's create the equivalent:
git init --bare vimide-manual
cd vimide-manual
git remote add --mirror origin https://github.com/matelakat/vimide
git fetch
git pack-refs --all --prune
cd ..
You can see that the two directories are the same:
diff -r vimide-with-clone/ vimide-manual/ && echo "ALL the same"
ALL the same

No comments:

Post a Comment