Skip to content

Instantly share code, notes, and snippets.

@bergkvist
Created August 26, 2022 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bergkvist/a92ff2a19c26d6140770285ec24b4ccb to your computer and use it in GitHub Desktop.
Save bergkvist/a92ff2a19c26d6140770285ec24b4ccb to your computer and use it in GitHub Desktop.
Check if personal access token is working for private Python package registry using curl
#!/bin/sh
pip_index_url="example.com/pypi"
private_package="myprivatepackage"
personal_access_token="$1"
curl -k -s -L -o/dev/null -w"%{http_code}" --url "https://$pip_index_url/$private_package" --header "Authorization: Basic $(printf '%s' "$personal_access_token:" | base64)"
# To configure pip to use registry:
# export PIP_EXTRA_INDEX_URL="https://$personal_access_token@$pip_index_url"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment