DEV Community

Marco Kamner
Marco Kamner

Posted on • Originally published at blog.marco.ninja on

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"

Enter fullscreen mode Exit fullscreen mode

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"

Enter fullscreen mode Exit fullscreen mode

Top comments (0)