Settings for GitHub 2-steps Verification on Mac (without Using Terminal!)

This is a note about settings to use git push with 2-step verification GitHub account without using Terminal.
In this article, I used GitHub Desktop (as a GitHub client) and Atom (as a text editor) instead of typing on Terminal. (I guess that you can replicate those steps by other applications which is familiar with you.)

This article is for non-engineers who need to use Git reluctantly, so I write only the minimum steps.

Overview

  1. get GitHub Personal access tokens
  2. create .netrc file on your home directory

Get GitHub Personal Access Tokens

You should get your personal access token from [Settings] > [Developer settings] > [Personal access tokens] on github.com first.

[Settings] > [Developer settings] > [Personal access tokens]

After click [Generate new token], GitHub would request to type description and select scopes.

Type the description for new token and select scopes

Click [Generate token] — the green button at the bottom of that page — , then the new token would be shown.

You can use new token now!

Create .netrc File on Your Home Directory

Next, you should create or update .netrcfile on your home directory.

Open a text editor and create new file, and save as /Users/{your_name}/.netrc. The application might warn it’s a system file, but you can agree it. Then, type following settings and save the file.

machine github.com
login {your_github_account}
password {your_github_personal_access_token}
protocol https

After that, you would be able to push to your project repository by GitHub client. (In my case, I needed to restart GitHub Desktop.)

Like what you read? Give Wife of Villon a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.