To install this, what worked for me:
- Install the GitHub CLI using whatever method works best for you; I used
brew install gh
. - Authorize your local system with GitHub with the appropriate scopes:
gh auth refresh --scopes=read:packages,write:packages
-
Save the file
docker-credential-gh
to somewhere in your path (try/usr/local/bin
) and mark it as executable (chmod a+x /usr/local/bin/docker-credential-gh
). -
Edit
~/.docker/config.json
and ensure that the config settings as described in the gist above are set properly. -
Run
docker login ghcr.io
to verify that authentication is working.