I've clone a project on GitHub on my Raspberry Pi, create a new branch and push everything to the repository. For this I needed next commands:
git clone https://www.github.com/heinpauwelyn/my_repo git checkout -b raspberry git push origin raspberry
The problem I've got is that I can't push the branch to GitHub.com. I need to enter my username and password, but I can't use 2FA for that. Is this a bug in Git or GitHub and is there a way to get an authentication key and enter it?
I'll not enable the 2FA on GitHub.
If you enabled two-factor authentication in your GitHub account you won't be able to push via HTTPS using your accounts password. Instead you need to generate a personal access token. This can be done in the application settings of your GitHub account.
Before you can require organization members, outside collaborators, and billing managers to use two-factor authentication, you must enable two-factor authentication for your account on GitHub.
with 2FA you have to create a personal access token to use as a password when authenticating to GitHub on the command line with HTTPS URLs: https://help.github.com/articles/which-remote-url-should-i-use/#when-2fa-is-enabled
or you can clone with ssh https://help.github.com/articles/which-remote-url-should-i-use/#cloning-with-ssh-urls (may also be useful: https://help.github.com/articles/generating-an-ssh-key/)
You have to generate an access token and use the access token instead the password. For example:
$ git clone https://github.com/username/repo.git Username: your_username Password: your_token
Doc: https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With