Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 1 | git-upload-pack(1) |
| 2 | ================== |
Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | c3f0baa | 2007-01-18 15:53:37 -0800 | [diff] [blame] | 6 | git-upload-pack - Send objects packed back to git-fetch-pack |
Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Martin von Zweigbergk | 7791a1d | 2011-07-01 22:38:26 -0400 | [diff] [blame] | 11 | [verse] |
Antoine Queru | 9812f21 | 2016-05-31 11:57:08 +0200 | [diff] [blame] | 12 | 'git-upload-pack' [--[no-]strict] [--timeout=<n>] [--stateless-rpc] |
| 13 | [--advertise-refs] <directory> |
Andreas Heiduk | ad47194 | 2018-10-22 22:45:43 +0200 | [diff] [blame] | 14 | |
Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 15 | DESCRIPTION |
| 16 | ----------- |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 17 | Invoked by 'git fetch-pack', learns what |
Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 18 | objects the other side is missing, and sends them after packing. |
| 19 | |
| 20 | This command is usually not invoked directly by the end user. |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 21 | The UI for the protocol is on the 'git fetch-pack' side, and the |
Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 22 | program pair is meant to be used to pull updates from a remote |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 23 | repository. For push operations, see 'git send-pack'. |
Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 24 | |
Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 25 | OPTIONS |
| 26 | ------- |
Johannes Schindelin | 83a5ad6 | 2007-02-20 03:01:44 +0100 | [diff] [blame] | 27 | |
Antoine Queru | 9812f21 | 2016-05-31 11:57:08 +0200 | [diff] [blame] | 28 | --[no-]strict:: |
Elijah Newren | 384f7d1 | 2023-10-08 06:45:05 +0000 | [diff] [blame] | 29 | Do not try <directory>/.git/ if <directory> is not a Git directory. |
Johannes Schindelin | 83a5ad6 | 2007-02-20 03:01:44 +0100 | [diff] [blame] | 30 | |
Stephan Beyer | 3240240 | 2008-06-08 03:36:09 +0200 | [diff] [blame] | 31 | --timeout=<n>:: |
Johannes Schindelin | 83a5ad6 | 2007-02-20 03:01:44 +0100 | [diff] [blame] | 32 | Interrupt transfer after <n> seconds of inactivity. |
| 33 | |
Antoine Queru | 9812f21 | 2016-05-31 11:57:08 +0200 | [diff] [blame] | 34 | --stateless-rpc:: |
| 35 | Perform only a single read-write cycle with stdin and stdout. |
| 36 | This fits with the HTTP POST request processing model where |
| 37 | a program may read the request, write a response, and must exit. |
| 38 | |
Ævar Arnfjörð Bjarmason | 98e2d9d | 2021-08-05 03:25:43 +0200 | [diff] [blame] | 39 | --http-backend-info-refs:: |
| 40 | Used by linkgit:git-http-backend[1] to serve up |
| 41 | `$GIT_URL/info/refs?service=git-upload-pack` requests. See |
Ævar Arnfjörð Bjarmason | 1e23201 | 2022-08-04 18:28:41 +0200 | [diff] [blame] | 42 | "Smart Clients" in linkgit:gitprotocol-http[5] and "HTTP |
Jacob Stopak | c9dba10 | 2022-09-11 03:23:20 -0700 | [diff] [blame] | 43 | Transport" in the linkgit:gitprotocol-v2[5] |
Ævar Arnfjörð Bjarmason | 1e23201 | 2022-08-04 18:28:41 +0200 | [diff] [blame] | 44 | documentation. Also understood by |
Ævar Arnfjörð Bjarmason | 98e2d9d | 2021-08-05 03:25:43 +0200 | [diff] [blame] | 45 | linkgit:git-receive-pack[1]. |
Antoine Queru | 9812f21 | 2016-05-31 11:57:08 +0200 | [diff] [blame] | 46 | |
Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 47 | <directory>:: |
| 48 | The repository to sync from. |
| 49 | |
Jeff King | 2834a72 | 2021-09-10 10:09:56 -0400 | [diff] [blame] | 50 | ENVIRONMENT |
| 51 | ----------- |
| 52 | |
| 53 | `GIT_PROTOCOL`:: |
| 54 | Internal variable used for handshaking the wire protocol. Server |
| 55 | admins may need to configure some transports to allow this |
| 56 | variable to be passed. See the discussion in linkgit:git[1]. |
| 57 | |
Jeff King | 7b70e9e | 2024-04-16 04:35:33 -0400 | [diff] [blame] | 58 | `GIT_NO_LAZY_FETCH`:: |
| 59 | When cloning or fetching from a partial repository (i.e., one |
| 60 | itself cloned with `--filter`), the server-side `upload-pack` |
| 61 | may need to fetch extra objects from its upstream in order to |
| 62 | complete the request. By default, `upload-pack` will refuse to |
| 63 | perform such a lazy fetch, because `git fetch` may run arbitrary |
| 64 | commands specified in configuration and hooks of the source |
| 65 | repository (and `upload-pack` tries to be safe to run even in |
| 66 | untrusted `.git` directories). |
| 67 | + |
| 68 | This is implemented by having `upload-pack` internally set the |
| 69 | `GIT_NO_LAZY_FETCH` variable to `1`. If you want to override it |
| 70 | (because you are fetching from a partial clone, and you are sure |
| 71 | you trust it), you can explicitly set `GIT_NO_LAZY_FETCH` to |
| 72 | `0`. |
| 73 | |
Jeff King | e69ac42 | 2024-04-16 04:52:13 -0400 | [diff] [blame] | 74 | SECURITY |
| 75 | -------- |
| 76 | |
| 77 | Most Git commands should not be run in an untrusted `.git` directory |
| 78 | (see the section `SECURITY` in linkgit:git[1]). `upload-pack` tries to |
| 79 | avoid any dangerous configuration options or hooks from the repository |
| 80 | it's serving, making it safe to clone an untrusted directory and run |
| 81 | commands on the resulting clone. |
| 82 | |
| 83 | For an extra level of safety, you may be able to run `upload-pack` as an |
| 84 | alternate user. The details will be platform dependent, but on many |
| 85 | systems you can run: |
| 86 | |
| 87 | git clone --no-local --upload-pack='sudo -u nobody git-upload-pack' ... |
| 88 | |
Josh Triplett | d49483f | 2011-07-08 16:14:10 -0700 | [diff] [blame] | 89 | SEE ALSO |
| 90 | -------- |
| 91 | linkgit:gitnamespaces[7] |
| 92 | |
Junio C Hamano | 8b3d9dc | 2005-07-14 00:08:37 -0700 | [diff] [blame] | 93 | GIT |
| 94 | --- |
Christian Couder | 9e1f0a8 | 2008-06-06 09:07:32 +0200 | [diff] [blame] | 95 | Part of the linkgit:git[1] suite |