A couple of blog posts ago I wrote about how you could use a GitHub repository to act as an NPM package. I went on to explain how you could configure your local git installation to authenticate with GitHub (in the event that your package is hosted in a private GitHub repository). GitHub has now deprecated the authentication method that I described, so in this post I’d like to share an updated set of instructions.
1. In a terminal, type
python to open up the python interpreter.
2. In the python interpreter, enter the following:
YOUR_GITHUB_USERNAME with your GitHub username, and,
YOUR_GITHUB_TOKEN with the GitHub personal access token that you created last time.
3. Copy the output of the function in Step 2.
4. Open up
~/.gitconfig in your favourite editor.
5. Add the following to the end of the file:
extraheader = Authorization: Basic VALUE_COPIED_IN_STEP_3
YOUR_GITHUB_USERNAME with your GitHub username,
YOUR_GITHUB_REPO_NAME with your repository name and
VALUE_COPIED_IN_STEP_3 with the value you copied in step 3.