pip install from git repository


Install a pip package from a git repo, using a specified git reference:

$REPOSITORY = "https://gitlab.com/mkamner/example.git"
$GIT_REF = "my-branch-or-tag-or-sha"

pip install "git+$REPOSITORY/@$GIT_REF"

If the package resides in a sub-directory this can be specified like this:

$REPOSITORY = "https://gitlab.com/mkamner/example.git"
$GIT_REF = "my-branch-or-tag-or-sha"
$DIRECTORY = "my-folder"

pip install "git+$REPOSITORY/@$GIT_REF#subdirectory=$DIRECTORY"
python  pip  git 

See also