Cannot clone github repository - Logon failed - github

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.

Related

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

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.

How can I choose what account is used when accessing GitHub from VSCode?

VS Code has a builtin extension GitHub Authentication that manages creation of a GitHub Personal Access Token and automatic logins.
However, if you are using more then one GitHub account, the extension might try generating a PAT for the wrong account, resulting in an access denied.
Logon failed, use ctrl+c to cancel basic credential prompt.
remote: Permission to MyAccount/repo.git denied to OtherAccount.
fatal: unable to access 'https://github.com/MyAccount/repo.git/': Failure when receiving data from the peer
The remedy is to abort the web session started by GitHub Authentication, and then in the message bar of VSCode, click on GitHub Authentication to trigger the manual failback PAT handling.
First make sure you have a current PAT created for repo access for MyAccount on GitHub. Then copy the PAT and enter it VSCode when prompted.

Source tree fix for git Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead [duplicate]

This question already has answers here:
Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead [duplicate]
(25 answers)
Closed 1 year ago.
FYI this is specifically for sourcetree
I am having this error when pulling in sourcetree, it was working just fine yesterday but it suddenly had this error.
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch origin
remote: Password authentication is temporarily disabled as part of a brownout. Please use a personal access token instead.
remote: Please see https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/ for more information.
fatal: unable to access 'https://github.com/London-Foster/frontend.git/': The requested URL returned error: 403
I tried having a personal access token and use it on source tree but still was not able to login.
1 - Generate a new token from git dev settings
2 - In SourceTree, you just need to change your repository settings there:
3 - Change the URL/Path with the new format:
https://<USERNAME>:<TOKEN>#<GIT_URL>.git
4 - Press OK and it is good now!
in source tree > open repo settings > remotes tab > edit the remote "URL/path" to be
https://{personal-access-token>#github.com}/{<my-repo>}.git>
then save and try to push
i did like #heratyian answer and works fine.
Step by step using the terminal and github
Remove repo
git remote remove origin
Generate personal access token
https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token
Add remote back using personal access token
Remember to replace <personal-access-token> and <my-repo> with your credentials.
git remote add origin https://<personal-access-token>#github.com/<my-repo>.git>
If on Windows, open the Credentials Manager and delete your github credentials if any.
If on macOS, open the Keychain Access app and delete your github credentials if any.
Then, get a Personal Access Token by following the guide here https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token
Then push your code as normal and when asked enter your newly generated personal access token.
I went:
Tools>Options>Authentication. Edited my account.
I changed Authentication from Basic to OAuth. And now the brownout no longer affects me.
After setting up my PAT and setting up my account in Sourcetree menu -> Preferences -> Accounts, I still got the brownout error.
Adding your account in SourceTree seems to prompt for a password upon opening.
I set up git to cache my credentials:
https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git
Then in SourceTree I re-cloned my repo. Got prompted for a password - entered my PAT. Now it's working fine.
I have solved the issue, just to ad up on woland's comment.
First add a personal access token then add it in your credentials
Second add a remote by clicking the gear settings then add a remote
Add the remote of your repository then link it with your account that has logged personal access token.
lastly fetch to that remote origin.

How do I sign in to GitHub from command line after password access is removed?

GitHub is retiring password based authentication for command line tools: https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
Normally I work in some server, git clone https://...., enter my username and password and get the code that I have to deploy.
What am I supposed to do now? Do I create a token, write it down on a piece of paper, take it with me and retype it into a terminal? Seems a bit too convoluted for just getting some code. Is there some other "intended" workflow?
There are a few options:
You can create a personal access token in your github settings and use that instead of your account password.
you can use SSH to connect
you can rely on the Git Credential Manager Core which will perform an OAuth check either by popping up a UI or giving you an url to paste into a browser.
some hardware tokens will enable you to perform authentication.

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.