Skip to content
This repository was archived by the owner on Feb 15, 2026. It is now read-only.

Commit 4f75a8c

Browse files
KemingHegithub-actions[bot]
authored andcommitted
docs(src/assets/): update uv official documentation
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent f5ff64f commit 4f75a8c

76 files changed

Lines changed: 22999 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/assets/uv/_metadata.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source_repo: astral-sh/uv
2+
docs_path: docs
3+
updated_at: 2025-07-16T02:51:59Z
4+
commit_sha: 8d6d0678a71d86020caaf20107b1e81af29f471d

src/assets/uv/assets/favicon.ico

7.23 KB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Loading
3.91 KB
Loading
2.23 KB
Loading
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Authentication
2+
3+
## Git authentication
4+
5+
uv allows packages to be installed from Git and supports the following schemes for authenticating
6+
with private repositories.
7+
8+
Using SSH:
9+
10+
- `git+ssh://git@<hostname>/...` (e.g., `git+ssh://git@github.com/astral-sh/uv`)
11+
- `git+ssh://git@<host>/...` (e.g., `git+ssh://git@github.com-key-2/astral-sh/uv`)
12+
13+
See the
14+
[GitHub SSH documentation](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh)
15+
for more details on how to configure SSH.
16+
17+
Using a password or token:
18+
19+
- `git+https://<user>:<token>@<hostname>/...` (e.g.,
20+
`git+https://git:github_pat_asdf@github.com/astral-sh/uv`)
21+
- `git+https://<token>@<hostname>/...` (e.g., `git+https://github_pat_asdf@github.com/astral-sh/uv`)
22+
- `git+https://<user>@<hostname>/...` (e.g., `git+https://git@github.com/astral-sh/uv`)
23+
24+
When using a GitHub personal access token, the username is arbitrary. GitHub doesn't allow you to
25+
use your account name and password in URLs like this, although other hosts may.
26+
27+
If there are no credentials present in the URL and authentication is needed, the
28+
[Git credential helper](#git-credential-helpers) will be queried.
29+
30+
!!! important
31+
32+
When using `uv add`, uv _will not_ persist Git credentials to the `pyproject.toml` or `uv.lock`.
33+
These files are often included in source control and distributions, so it is generally unsafe
34+
to include credentials in them.
35+
36+
If you have a Git credential helper configured, your credentials may be automatically persisted,
37+
resulting in successful subsequent fetches of the dependency. However, if you do not have a Git
38+
credential helper or the project is used on a machine without credentials seeded, uv will fail to
39+
fetch the dependency.
40+
41+
You _may_ force uv to persist Git credentials by passing the `--raw` option to `uv add`. However,
42+
we strongly recommend setting up a [credential helper](#git-credential-helpers) instead.
43+
44+
### Git credential helpers
45+
46+
Git credential helpers are used to store and retrieve Git credentials. See the
47+
[Git documentation](https://git-scm.com/doc/credential-helpers) to learn more.
48+
49+
If you're using GitHub, the simplest way to set up a credential helper is to
50+
[install the `gh` CLI](https://github.com/cli/cli#installation) and use:
51+
52+
```console
53+
$ gh auth login
54+
```
55+
56+
See the [`gh auth login`](https://cli.github.com/manual/gh_auth_login) documentation for more
57+
details.
58+
59+
!!! note
60+
61+
When using `gh auth login` interactively, the credential helper will be configured automatically.
62+
But when using `gh auth login --with-token`, as in the uv
63+
[GitHub Actions guide](../guides/integration/github.md#private-repos), the
64+
[`gh auth setup-git`](https://cli.github.com/manual/gh_auth_setup-git) command will need to be
65+
run afterwards to configure the credential helper.
66+
67+
## HTTP authentication
68+
69+
uv supports credentials over HTTP when querying package registries.
70+
71+
Authentication can come from the following sources, in order of precedence:
72+
73+
- The URL, e.g., `https://<user>:<password>@<hostname>/...`
74+
- A [`.netrc`](https://everything.curl.dev/usingcurl/netrc) configuration file
75+
- A [keyring](https://github.com/jaraco/keyring) provider (requires opt-in)
76+
77+
If authentication is found for a single index URL or net location (scheme, host, and port), it will
78+
be cached for the duration of the command and used for other queries to that index or net location.
79+
Authentication is not cached across invocations of uv.
80+
81+
`.netrc` authentication is enabled by default, and will respect the `NETRC` environment variable if
82+
defined, falling back to `~/.netrc` if not.
83+
84+
To enable keyring-based authentication, pass the `--keyring-provider subprocess` command-line
85+
argument to uv, or set `UV_KEYRING_PROVIDER=subprocess`.
86+
87+
Authentication may be used for hosts specified in the following contexts:
88+
89+
- `[index]`
90+
- `index-url`
91+
- `extra-index-url`
92+
- `find-links`
93+
- `package @ https://...`
94+
95+
See the [index authentication documentation](./indexes.md#authentication) for details on
96+
authenticating index URLs.
97+
98+
See the [`pip` compatibility guide](../pip/compatibility.md#registry-authentication) for details on
99+
differences from `pip`.
100+
101+
!!! important
102+
103+
When using `uv add`, uv _will not_ persist index credentials to the `pyproject.toml` or `uv.lock`.
104+
These files are often included in source control and distributions, so it is generally unsafe
105+
to include credentials in them. However, uv _will_ persist credentials for direct URLs, i.e.,
106+
`package @ https://username:password:example.com/foo.whl`, as there is not currently a way to
107+
otherwise provide those credentials.
108+
109+
If credentials were attached to an index URL during `uv add`, uv may fail to fetch dependencies
110+
from indexes which require authentication on subsequent operations. See the
111+
[index authentication documentation](./indexes.md#authentication) for details on persistent
112+
authentication for indexes.
113+
114+
## Authentication with alternative package indexes
115+
116+
See the [alternative indexes integration guide](../guides/integration/alternative-indexes.md) for
117+
details on authentication with popular alternative Python package indexes.
118+
119+
## Custom CA certificates
120+
121+
By default, uv loads certificates from the bundled `webpki-roots` crate. The `webpki-roots` are a
122+
reliable set of trust roots from Mozilla, and including them in uv improves portability and
123+
performance (especially on macOS, where reading the system trust store incurs a significant delay).
124+
125+
However, in some cases, you may want to use the platform's native certificate store, especially if
126+
you're relying on a corporate trust root (e.g., for a mandatory proxy) that's included in your
127+
system's certificate store. To instruct uv to use the system's trust store, run uv with the
128+
`--native-tls` command-line flag, or set the `UV_NATIVE_TLS` environment variable to `true`.
129+
130+
If a direct path to the certificate is required (e.g., in CI), set the `SSL_CERT_FILE` environment
131+
variable to the path of the certificate bundle, to instruct uv to use that file instead of the
132+
system's trust store.
133+
134+
If client certificate authentication (mTLS) is desired, set the `SSL_CLIENT_CERT` environment
135+
variable to the path of the PEM formatted file containing the certificate followed by the private
136+
key.
137+
138+
Finally, if you're using a setup in which you want to trust a self-signed certificate or otherwise
139+
disable certificate verification, you can instruct uv to allow insecure connections to dedicated
140+
hosts via the `allow-insecure-host` configuration option. For example, adding the following to
141+
`pyproject.toml` will allow insecure connections to `example.com`:
142+
143+
```toml
144+
[tool.uv]
145+
allow-insecure-host = ["example.com"]
146+
```
147+
148+
`allow-insecure-host` expects to receive a hostname (e.g., `localhost`) or hostname-port pair (e.g.,
149+
`localhost:8080`), and is only applicable to HTTPS connections, as HTTP connections are inherently
150+
insecure.
151+
152+
Use `allow-insecure-host` with caution and only in trusted environments, as it can expose you to
153+
security risks due to the lack of certificate verification.

0 commit comments

Comments
 (0)