Unable to login to GitHub Package Registry

In this article refences the same command you are executing and the previous answer is correct. Just leaving here this to reinforce it:

Link to Github configuration page

There just Ctrl + F in search for npm login --registry=https://npm.pkg.github.com


I ran into this same issue because I was attempting to use my Github password to login, when in fact you need to use a Github Personal Access Token as the password.

Username: YOUR_GITHUB_USERNAME  
Password: YOUR_GITHUB_PERSONAL_ACCESS_TOKEN  
Email: YOUR_EMAIL

Do you have 2-factor authentication enabled on your GitHub account? If so, try creating a personal access token and using that instead of a password. Here are instructions to create a token.

Update: Github now requires personal access tokens for all accounts, regardless of if you have 2fa enabled