gitauthenticationgithubcygwin

How to configure Cygwin git for two-factor authentication at github.com?


I'm a git newbie. I setup an account at github.com with two-factor authentication.

I can use it fine with the MINGW32 bash shell, but I'm trying to use it with Cygwin.

This is what I get:

dave@ENOUGH /cygdrive/u/testG
$ git clone  https://github.com/nerdfever/<project>
Cloning into '<project>'...
Username for 'https://github.com':
Password for 'https://Nerdfever@github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/nerdfever/<project>/'

I did setup the user.name and user.email configs in Cygwin git.

What do I need to do to make this work?


Solution

  • I don't know why somebody downvoted me, but anyway I figured it out:

    Git under Cygwin:
    a) Install git from Cygwin setup.exe
    b) git config --global user.name "<username>"
    c) git config --global user.password "<password>"
    d) git config --global credential.helper store
    e) Get personal access token per https://help.github.com/articles/creating-an-access-token-for-command-line-use/
    f) git clone <project>; first time it'll ask for credentials, after that it will store them
    

    Note that when git asks for your password, give it your Personal Access Token (not your password).