How to pip install From a Git Repository

You can install a Python package from a Git repository by running the pip install git+ command followed by the URL of the repository. For example, to install the Requests module from its GitHub repository:

pip install git+

This requires Git installed, since the git command is executed within a subprocess.

If you want to install a specific commit, add @ (at symbol) followed by the commit hash, for example:

pip install git+

You might also specify a branch or tag:

pip install git+

If you need to install from a private GitHub repository for which you have a private access token (PAT), use:

pip install git+

(Replace MY_GITHUB_USER and MY_GITHUB_TOKEN with the proper values.)

If, for security reasons, the GitHub user and token are stored in environment variables (e.g. in GITHUB_USER and GITHUB_TOKEN), you can inject these variables as follows.

pip install git+https://$GITHUB_USER:$