12.1.17

using 2FA github for pushing and pulling

Recently kubernetes upstream moved to *mandatory* 2FA for all members.

I was a little worried I'd need to put a pin down every time i typed "git push", but actually, theres a super easy mechanism to make git seamless with 2FA.

1) Follow https://help.github.com/articles/creating-an-access-token-for-command-line-use/

Now, lets say the token is abc2oj29f82j38jjjsdf.  Obviously im making this up.

2) Then just make a custom URL in your git config like this:

[remote "origin"]
        url = https://jayunit100:abc2oj29f82j38jjjsdf@github.com/jayunit100/kubernetes.git
        fetch = +refs/heads/*:refs/remotes/origin/*


Now git push/pull dont require 2FA and just use your custom created token.  I guess theres a chance it might have to be regenerated someday, but otherwise, it should never need to be changed.

No comments:

Post a Comment