W3docs

pip install from git repo branch

You can use pip to install a package from a git repository and specify a branch by using the following syntax:

You can use pip to install a package from a git repository and specify a branch by using the following syntax:

Syntax

pip install git+https://github.com/user/repo.git@branch#egg=package-name

You'll need to replace user, repo, branch, and package-name with the appropriate values for the git repository and package you want to install.

For example, if you want to install a package called mypackage from a repository called myrepo on a branch called dev from a user called johndoe, you would use the following command:

Example

pip install git+https://github.com/johndoe/myrepo.git@dev#egg=mypackage

You can also use an SSH link instead of an HTTPS link:

Using SSH

pip install git+ssh://git@github.com/johndoe/myrepo.git@dev#egg=mypackage

Notes:

  • The #egg=package-name fragment is deprecated in modern pip versions. You can omit it if the repository contains a valid pyproject.toml or setup.py.
  • Git must be installed and available in your system's PATH for these commands to work.