tech:notes_-_git_bundle
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_-_git_bundle [2025/09/10 11:03] – créée Jean-Baptiste | tech:notes_-_git_bundle [2026/07/16 11:53] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # 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:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * http:// | ||
| + | * https:// | ||
| + | |||
| + | 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' | ||
| + | First clone the repository, and include the --mirror option. | ||
| + | |||
| + | ~~~bash | ||
| + | git clone --mirror git@example.org: | ||
| + | ~~~ | ||
| + | |||
| + | Then run | ||
| + | ~~~bash | ||
| + | cd /opt/plop | ||
| + | git bundle create repo.bundle --all | ||
| + | git tag -f lastAGbundle master | ||
| + | |||
| + | cd /opt/plop | ||
| + | git bundle create ~/ | ||
| + | git tag -f lastAGbundle master | ||
| + | |||
| + | cd / | ||
| + | git clone / | ||
| + | cd RepoName | ||
| + | git gc # Clears some errors | ||
| + | # Optionally, push to other remotes | ||
| + | |||
| + | git bundle verify mybundle | ||
| + | ~~~ | ||
| + | |||
| + | Exemple d' | ||
| + | ~~~ini | ||
| + | [remote " | ||
| + | url = / | ||
| + | fetch = refs/ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | machineB$ cd R2 | ||
| + | machineB$ git pull | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ## Autre | ||
| + | |||
| + | ~~~ | ||
| + | $ git bundle list-heads ../ | ||
| + | 71b84daaf49abed142a373b6e5c59a22dc6560dc refs/ | ||
| + | |||
| + | $ git fetch ../ | ||
| + | From ../ | ||
| + | * [new branch] | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | git clone --bundle-uri=https:// | ||
| + | git clone --bundle-uri=https:// | ||
| + | ~~~ | ||
| + | |||
