I'm unable to run github cli commands because I keep running into an Authentication Error. I'm using the correct username and password. Details below - github

I'm following the steps listed here to try and link an existing local project to a new repo on GitHub.
I ran gh repo create but got an Authentication error, with a note to update my credentials in the .gitsomeconfig file. I ran gh configure and entered my GitHub username and my GitHub password (since I chose that option instead of using an authentication token). I entered them exactly the same as I type them in. Then I ran gh repo create again and still ran into the Authentication error. I output the content of .gitsomeconfig and verified that the user_login is correct (It doesn't display my password anywhere).
I've tried running gh configureat least 6 times now. I've copied and pasted from Lastpass to be extra sure I'm entering credentials correctly. I've tried both my username and my email address since I wasn't sure which gh configure actually wanted for username, but neither seem to work. I'm at a loss for what might be going wrong. Any thoughts or suggestions?

The right command is gh auth login, using your GitHub account name and your GitHub token (not password, your PAT: Personal Access Token, with scopes "admin:org, gist, repo, user, workflow")
Then you can check with gh auth status.
Once the status is clean (authenticated), you can proceed with other commands, like gh repo create.

Related

Problems with cloning a git repository to new computer

This might be trivial, but it has caused me a ton of headaches over the last few days.
Recently i have tried to clone my git repos onto my new computer, but up until now, with no succes.
After typing "git clone " followed by the respective git URL, my comand line is asking for my Username and passwort. Even though i provide both correctly, i get the following error:
I do not have 2FA enabled, and as i understand it, the access token is only required in the case of enabled 2FA.
Does anyone have any idea what i am doing wrong?
A token is not jsut required for 2FA.
It is now (since mid 2021) required for any web operation with authentication, using said token as a password.
You need to create a PAT (Personal Access Token), with scope 'repo'.

Asking for password when pushing updates to GitHub

I initialized a new repository, and pushed my code to GitHub.
After that, I updated my README file and tried to push on GitHub again, but when I did that, it asks me for password, and it didn't asked me for password when I pushed my code to GitHub for first time.
I also tried entering my GitHub account password, it fails.
I also tried use the key which I generated as a password, but still no luck.
Can anyone please guide me how to solve this problem?
This is the error which I am getting after entering the password:
For HTTPS URL, you need to use a PAT (Personal Access Token) with scope repo as a password.
And you need to cache it using a credential helper, like Git Credential Manager (cross platform). Once that helper is installed:
git config credential.helper manager
Should you switch to an SSH URL (git#github.com:<me>/<myRepo>), you need, if you have protected your private SSH key with a passphrase, to auto-launch ssh-agent when you start a new session. See "Working with SSH key passphrases".

Cannot clone github repository - Logon failed

I'm trying to clone a github repository locally using the following command
git clone https://github.com/*myuser*/*myrepo.git*
This brings up the authentication dialog
Here I am using the exact same credentials with which I can login to the website.
But I always get a Logon failed error.
I am not using two factor authentication and tried to reset my password but without result.
Am I missing something?
Ok, seems username-password usage is deprecated and you have to create a Personal Access Token.
https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
Using this access token worked for me with the basic credential prompt, not when using the dialog window.

How to solve an error while cloning a private repository

I have a repository which is private. Before, I was able to clone it from my terminal by giving the username and password. Few days back I got a mail from GitHub to enable 2FA in my account. I did but now I see my account password doesn't seem to work when I give my password in my terminal. I use Google Authenticator as my TOTP app and I also tried giving that password but still it says authentication failure. Please help me out
You need a "Personal Access Token" (PAT).
In order to generate one, go to your GitHub settings and click on the category called "Developer settings". In that section, go to personal tokens.
There you can generate a new access token (make surer to check repo). When you clone your repository, use this token instead of your password. Now you should be able to clone it.
You can read more about this process here: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token

Trying to import GitLab repository to Azure repository but I am getting the below error

Import request cannot be processed due to one of the following reasons:
Clone URL is incorrect.
Clone URL requires authorization.
NOTE: I am getting this error even though I am providing the correct username and password. And I am able to clone the repository locally with the same clone url.
If you are using credentials (username/password) to clone the repository, that should mean its URL is an HTTPS one.
This answer suggests an issue with an empty repository or a wrong PAT.
The last suggestions reminds me you should try and use a token as your password, instead of your GitLab account password. See if you can create a PAT (Personal Access Token), and use that as a password.