Skip to content

Git credentialsGit 資格情報

uv allows packages to be installed from private Git repositories using SSH or HTTP authentication.uv は、SSH または HTTP 認証を使用してプライベート Git リポジトリからパッケージをインストールできるようにします。

SSH authenticationSSH 認証

To authenticate using an SSH key, use the ssh:// protocol:SSH キーを使用して認証するには、ssh:// プロトコルを使用します:

  • git+ssh://git@<hostname>/... (e.g., git+ssh://git@github.com/astral-sh/uv)git+ssh://git@<hostname>/... (例:git+ssh://git@github.com/astral-sh/uv
  • git+ssh://git@<host>/... (e.g., git+ssh://git@github.com-key-2/astral-sh/uv)git+ssh://git@<host>/... (例:git+ssh://git@github.com-key-2/astral-sh/uv

SSH authentication requires using the username git.SSH認証にはユーザー名 git を使用する必要があります。

See the GitHub SSH documentation for more details on how to configure SSH.SSHの設定方法についての詳細は、 GitHub SSHドキュメントを参照してください。

HTTP authenticationHTTP認証

To authenticate over HTTP Basic authentication using a password or token:パスワードまたはトークンを使用してHTTP Basic認証を行うには:

  • git+https://<user>:<token>@<hostname>/... (e.g., git+https://git:github_pat_asdf@github.com/astral-sh/uv)git+https://<user>:<token>@<hostname>/... (例: git+https://git:github_pat_asdf@github.com/astral-sh/uv
  • git+https://<token>@<hostname>/... (e.g., git+https://github_pat_asdf@github.com/astral-sh/uv)git+https://<token>@<hostname>/... (例:git+https://github_pat_asdf@github.com/astral-sh/uv
  • git+https://<user>@<hostname>/... (e.g., git+https://git@github.com/astral-sh/uv)git+https://<user>@<hostname>/... (例:git+https://git@github.com/astral-sh/uv

Note注意

When using a GitHub personal access token, the username is arbitrary. GitHub doesn't allow you to use your account name and password in URLs like this, although other hosts may.GitHubの個人アクセストークンを使用する場合、ユーザー名は任意です。GitHubでは、このようなURLにアカウント名とパスワードを使用することは許可されていませんが、他のホストでは可能な場合があります。

If there are no credentials present in the URL and authentication is needed, the Git credential helper will be queried.URLに認証情報が存在せず、認証が必要な場合、Git credential helperが照会されます。

Persistence of credentials認証情報の永続性

When using uv add, uv will not persist Git credentials to the pyproject.toml or uv.lock. These files are often included in source control and distributions, so it is generally unsafe to include credentials in them.uv addを使用する場合、uvはpyproject.tomluv.lockにGit認証情報を永続化しません。これらのファイルはソース管理や配布に含まれることが多いため、一般的に認証情報を含めることは安全ではありません。

If you have a Git credential helper configured, your credentials may be automatically persisted, resulting in successful subsequent fetches of the dependency. However, if you do not have a Git credential helper or the project is used on a machine without credentials seeded, uv will fail to fetch the dependency.Git credential helperが設定されている場合、認証情報は自動的に永続化され、依存関係の取得が成功する可能性があります。しかし、Git credential helperがない場合や、認証情報が設定されていないマシンでプロジェクトが使用される場合、uvは依存関係を取得できません。

You may force uv to persist Git credentials by passing the --raw option to uv add. However, we strongly recommend setting up a credential helper instead.あなたは--rawオプションをuv addに渡すことでuvにGit認証情報を永続化させることができます。しかし、代わりにcredential helperを設定することを強くお勧めします。

Git credential helpersGit credential helpers

Git credential helpers are used to store and retrieve Git credentials. See the Git documentation to learn more.Git credential helpersはGit認証情報を保存および取得するために使用されます。詳細については、Gitのドキュメントを参照してください。

If you're using GitHub, the simplest way to set up a credential helper is to install the gh CLI and use:GitHubを使用している場合、credential helperを設定する最も簡単な方法は、このgh CLIをインストールし、次のように使用することです:

$ gh auth login

See the gh auth login documentation for more details.gh auth loginのドキュメントを参照して、詳細を確認してください。

Note注意

When using gh auth login interactively, the credential helper will be configured automatically. But when using gh auth login --with-token, as in the uv GitHub Actions guide, the gh auth setup-git command will need to be run afterwards to configure the credential helper.gh auth loginを対話的に使用する場合、credential helperは自動的に設定されます。しかし、gh auth login --with-tokenを使用する場合、uvのGitHub Actionsガイドのように、その後にgh auth setup-gitコマンドを実行してcredential helperを設定する必要があります。