{{tag>Brouillon Git AirGap}} # Notes - git bundle 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 * https://git-scm.com/book/fr/v2/Utilitaires-Git-Empaquetage-bundling * https://git-scm.com/docs/git-bundle/fr * https://git-scm.com/book/en/v2/Git-Tools-Bundling * https://www.kernel.org/pub/software/scm/git/docs/git-bundle.html * http://bayledes.free.fr/systeme/git.html * https://www.reddit.com/r/git/comments/th9tfu/using_git_bundle_to_keep_a_remote_repository_in/?rdt=32998 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 ~~~bash 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. ~~~bash git clone --mirror git@example.org:path/repo.git ~~~ Then run ~~~bash 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 ~~~ini [remote "origin"] url = /home/me/tmp/file.bundle fetch = refs/heads/*:refs/remotes/origin/* ~~~ ~~~ machineB$ cd R2 machineB$ git pull ~~~ == Autre ~~~ $ 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 ~~~ ~~~bash 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 ~~~