2FA give problems when pushing to GitHub
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.
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/)
Make "git push" work with 2FA · Issue #822 · github/hub · GitHub, I have hub installed, but when I run git push from a repository, I get this (and I'm pretty sure it's 2FA): jkeiser@Ettores-MBP Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more 2FA give problems when pushing to GitHub
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
Accessing GitHub using two-factor authentication, Webkul Blog Two factor authentication require user access token instead Today I face an issue when I was trying to push my recent changes on my GITHUB select the permission which you would like to give for that token. For information on accessing GitHub Desktop with two-factor authentication, see "Authenticating to GitHub" in the GitHub Desktop documentation. Using two-factor authentication with the command line After you've enabled 2FA, you must use a personal access token or SSH key instead of your password when accessing GitHub on the command line.
with 2FA you need to generate personal access token while pushing the code. That personal token will be used as a password while pushing the code to Github. You can see that how to create the personal access token from https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line. It will be used when you have clone the repo with http url. It will be working for all the repositories.
If you have cloned the through SSH then you can push your changing very easily without any changes in normal behavior after enabling the 2F authentication. For this you use SSH key passphrase as a password. First it requires you to create SSH key against your repository. You can generate SSH key from https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent It will be working only single repository only for that specific repsority again which this SSH key has been generated.
Make "git pull/push/clone" work with two factor authentication, 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: I have hub installed, but when I run git push from a repository, I get this (and I'm pretty sure it's 2FA):. jkeiser@Ettores-MBP ~/s/chef-provisioning-aws> set -x GIT_TRACE 1 jkeiser@Ettores-MBP ~/s/chef-provisioning-aws> git push Username for 'https://github.com': jkeiser Password for 'https://email@example.com': remote: Invalid username or password. fatal: Authentication failed for 'https
You can either use HTTPS URL of the repo or SSH URL of the for pushing, pulling, cloning or fetching operations from your local server after you have added 2FA on your GitHub account. The difference will be:
While using the HTTPS URL: Now for pushing, pulling, fetching or cloning operations, you have to generate a Personal access token form your GitHub account and that will be used as password whenever you are asked for a password. You have to keep the token secure.
While using the SSH URL: For Pushing, Pulling, Fetching or Cloning through SSH URL of the repo, you need to have a private key and public pair set up for your account. This will take a little amount of time but once you are done setting your private and public key, you will never be prompted for a username or password because now GitHub knows your identity.
For creating the private key and public key pair, read: Connecting to GitHub with SSH
Difference between using HTTPS URL and SSH URL:
While HTTPS is not blocked by any firewall or by any network, SSH may be blocked sometimes and you may not be able to use it, however, it happens rarely. While using HTTPS, as said you will be asked ofter for username and password(which is your personal access token), you can cache it using
credential.helper but it will save as a plain text.
While for SSH, you can generate a passphrase for your private key, How do I add a password to an OpenSSH private key that was generated without a password?
Now your private key will be secured but whenever you'll Push, Pull, Clone or Fetch, the passphrase will be asked each time. To avoid that you can use an SSH agent, SSH Key - Still asking for password and passphrase
GitHub Error: Authentication Failed from the Command Line, After setting up 2 Factor Authentication on GitHub, I couldn't push my git push origin my-branch How to Authenticate on GitHub with 2FA. GitHub is where people build software. More than 40 million people use GitHub to discover, fork, and contribute to over 100 million projects.
Two-Factor Authentication, Two-factor Authentication (2FA) provides an additional level of security to your you'll be prompted to activate your U2F device (usually by pressing a button on it), you can no longer use your normal account password to authenticate with Git issue between the authentication application and the GitLab instance itself. setup-gh-cli-auth-2fa.md These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using.
github push 2fa - Search, gist.github.com. Hi! I'm Liz, a Developer Advocate at honeycomb.io, and I spent my first weeks at the git - 2FA give problems when pushing to GitHub - Stack . Make “git pull/push/clone” work with two factor authentication Save Tweet Share Today I face an issue when I was trying to push my recent changes on my GITHUB directory.
GitHub says Authentication Failed, 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 Do you push to GitHub via SSH because you have 2-Factor Authentication turned on? You don't have to. In this webinar, we'll take a look at how to push and pull with GitHub over HTTPS so you don't