Transférer une dépôt Git vers une autre machine lorsque les deux machines n'ont pas de connexion directe (AirGap - offline environment)
Voir
We’ll discuss two cases:
Taking a full backup of a repository
Transferring the history of a repository to another machine when the two machines have no direct connection
Exemple de creation de Bundle Git
git bundle create mybundle v1.0.0..master git bundle create mybundle --since=10.days master git bundle create mybundle --all
Note that --all would not include remote-tracking branches… just like ordinary clone wouldn't either. First clone the repository, and include the --mirror option.
git clone --mirror git@example.org:path/repo.git
Then run
cd /opt/plop git bundle create repo.bundle --all git tag -f lastAGbundle master $ cd cd /opt/plop $ git bundle create ~/toAG/RepoName.bundle lastAGbundle..master --all $ git tag -f lastAGbundle master $ cd /path/to/AG/clone/location $ git clone /path/to/AG/bundles/RepoName.bundle -b master $ cd RepoName $ git gc # Clears some errors $ # Optionally, push to other remotes git bundle verify mybundle
Exemple d'importation de Bundle
[remote "origin"] url = /home/me/tmp/file.bundle fetch = refs/heads/*:refs/remotes/origin/*
machineB$ cd R2 machineB$ git pull
$ git bundle list-heads ../commits.bundle 71b84daaf49abed142a373b6e5c59a22dc6560dc refs/heads/master $ git fetch ../commits.bundle master:other-master From ../commits.bundle * [new branch] master -> other-master
git clone --bundle-uri=https://[cdn]/bundle/gitlab-base.bundle git clone --bundle-uri=https://[cdn]/bundle/gitlab-base.bundle https://gitlab.com/gitlab-org/gitlab-foss.git g2