VS Code: Get 'Bad credentials' when using Clone Repository - github

I use vscode version 1.45.1. I get 'Bad credentials' when using Clone Repository. Lately I changed my username at github. That could be the reason. How do I tell vs code that?

You'll need to open up Credential Manager in Windows and delete (or edit) the Github account there:
You'll need to restart Visual Studio Code for it to prompt you to login to Github again.
Also note that you may need to revoke the OAuth connection in Github under https://github.com/settings/applications:

Related

Error: repository checked out but no solution found - when cloning Github repo using Visual Studio 2019 for Mac

Using Visual Studio for Mac (vs 8.10.14) I am trying to clone an existing Github repository.
In Visual Studio I navigate to Version Control/Clone Repository... I fill out the https path (copied from my Github repo) and hit the Clone button. Prompted for Username I enter my Github username and for password I use my freshly generated PAT (Personal Access Token) with credentials for "repo"=Full control of private repositories.
Then the clone process starts but immediately stops with error message: "Repository checked out but no solution found". After selecting the only option "OK", the process stops fully without cloning a single line of code.
Has anyone found a solution already?

Configure Gitlab account to Visual studio code

I am using Visual Studio Code and working locally in a repository that is in Gitlab, but every time I use the command git push origin master I get a pop window to enter my Gitlab account and password. My question is there any form to configure my Gitlab account so I do not need to enter my credentials every time?
You can refer to this answer to know how to save your username and password for git in a secure way so that it doesn't ask you again and again.
How to save username and password in Git?
Also as you mentioned about VSCode, there are many extensions that helps you with handling git but one of those which I will recommend is GitLens. As it will also let you know who changed which part of code.

Unable To Clone Azure DevOps Repo From VSOnline

I'm attempting to clone a repo into my workspace on Visual Studio Code Online (Chrome browser) using the Azure Repos extension (https://online.visualstudio.com/environments):
When I attempt to execute the Team: Signin command, I get the error:
When I attempt to clone the repo from the terminal I get:
vsonline:~/workspace$ git clone https://dev.azure.com/MyOrganization/MyProject/_git/MyApp
Cloning into 'MyAppApp'...
Username for 'https://dev.azure.com': myemail#mycompany.com
Password for 'https://myemail#mycompany.com#dev.azure.com':
fatal: Authentication failed for 'https://dev.azure.com/MyOrganization/MyProject/_git/MyApp'
I have this setup with no problem in VS Code on my desktop, what am I doing wrong?
This error is caused by authentication when clone a repo from Azure DevOps Repos, it also led to your Azure Repos extension could not find a repo.
Please check Authentication overview and make sure the Username and Password are correct and workable.
I have been working on this for several days and I finally managed to crack it. 1. select clone in vscode 2. it will ask you to open on new vscode window so click yes 3. head over to devOps and click on generate git credentials 4. copy the long password and paste it in upper password field prompt in vscode
this worked for me so well, happy coding?

IntelliJ cannot log in to GitHub

For some reason, a new IntelliJ installation is unable to log in to GitHub. (The credentials are correct.)
It happens both when I try to "share project on githu" and "checkout project from version control", select Git and then try to log in to GitHub.
Here's the login prompt:
Server: github.com
Login: <my username>
Password: <my password>
And the error message:
Invalid authentication data. Can't create token:
scopes - [repo, gist] - not IntelliJ Plugin_1 422
Unprocessable Entity - Validation Failed
[OauthAccess; description]already_exists: null
Now, this is on a freshly installed Windows 10 computer, with a freshly installed IntelliJ. So there are no old tokens or anything like that anywhere in the system. This is the first attempt to access GitHub from IntelliJ. Logging in via web works fine.
That kind of error messages can be frustrating, as it takes more than a little knowledge on the subject to understand exactly what is wrong. Usually, however, the problem is either the authentication (invalid username/email/password) or that there's a problem with git (locally).
First of all, check that you have git installed by running "git" from the command prompt. This is a more common mistake than one would think.
Second, try y.bedrov's suggestion. Log in to github.com on the web. Settings -> Developer settings -> Personal access tokens. Create a new token and then, in IntelliJ, select Enter Token at the login prompt.
Tokens are considered a more secure way to authenticate, I believe.
Oh, in case you generated the token from GitHub and are unable to use that in IntelliJ...
Then, go to Settings -> Version Control -> GitHub
In the Login to GitHub popup, click "Use Token" on the top right corner of the popup.
Add your token and enjoy.
When you make first attempt to access GitHub from IntelliJ, you do not have intellij-github authorization in place and also tokens.
So, follow the instructions here to get rid to this issue.
https://www.jetbrains.com/help/idea/github.html#register-account
After this, the project can be easliy shared on github.
In my situation it was because I was behind a proxy and IntelliJ was not able to reach the internet.
To verify whether IntelliJ is able to reach the internet go to Settings>System Settings>HTTP Proxy
Click on check connection and try for example http://google.nl.
I had to set my proxy to Auto-detect so it will use the proxy of Windows.
From my experience, you will have to set the remote of this project, try to find the "Remote..." within the "VCS" tab, then when you set it, IntelliJ will open your default browser and there is a permission check, which is what lead to your error message.
In short, Set remote, Authorize IntelliJ on GitHub Settings.
The issue is that IDE tries to create a token with the name that already exists. Appears to be related with the token name case - see https://youtrack.jetbrains.com/issue/IDEA-198120
As a workaround, navigate to https://github.com/settings/tokens and delete all tokens called IntelliJ Plugin (including those with suffix)
Couple of issues can be there to block you from accessing your github repo and throwing 403 error. Hence please go step by step.
Step-1 : Local git is corrupted or not working
git branch -r [If it gives result you are good]
git ls-remote --heads <remot_git_location>
if one of the above is working then your local git is good. If not use
git config --global --unset credential.helper
Step-2 : From your IDE (IntelliJ or PHPStorm etc) see git is configured and test it.
Go to Default Settings-->GitHub and Your host should be "https://github.com"
Get your Github personal token. Login to your github account from browser. Settings -> Developer settings -> Personal access tokens.
o Select all “repo”, gist and “read.org” in your scope.
o Create the token
Last step: If still not working, Go to VCS--> GIT --> Remotes --> Change the repo to include token explicitly
https://user_name:<your_TOKEN>#github.com/reponame.git
Paste the token in your IDE and test the connection.
If your problem still persists then check if there is network issue.
I have had the same problem to sign up from Android Studio's interface to my GitHub account. At the end what worked is installing Git from VSC tab as this guy said:
https://stackoverflow.com/a/65059893/14715236
But i still not being able to access my account (note: with Login-Password method) so generating token it worked.
I also had the problem with logging to github using Intelij IDE. It shown "invalid authentication data" msg with 404 error. Installing the latest version of the IDE solve that problem.
If you use two factor auth then you need to use an access token.
If you use HTTPs access, after 2-factor authentication is enabled you will need to configure an Access token (BitBucket calls it app password) and use it to authenticate.
https://intellij-support.jetbrains.com/hc/en-us/articles/206537004-How-to-access-GIT-remote-repositories-with-2-factor-authentication
Github has disabled password based auth to api as here https://docs.github.com/en/rest/overview/other-authentication-methods
In my case somehow I was logged out and IDE was showing this error repeatedly instead of login prompt.
So, I just logged in again in setting-> Version Control -> github.
There I saw I was logged out.
After logging in, error was gone and prompt for
Access token was shown when I clicked on git->github on top menu of IDE.
Hope my answer helps you saving some time
Since August 13, 2021. GitHub no longer supports password authentication for git operations. You must generate a token in your GitHub account. Follow
"Settings> Developer Setting > Personal access tokens > tokens (classic)". while generating your token, you must "SET PERMISSION" for your token. Whenever you want to Sign In via Intellij or git terminal, you must enter your username and your token (instead of password) in the password textbox.

Error message 'Authentication failed on the git remote'

I'm trying to push, pull, and whatever to my GitHub repository from Visual Studio Code.
I enter my username and password, but I'm getting the error:
Authentication failed on the git remote.
I just logged in on github.com with the same user/password.
I tried creating a personal access token, using it as a password, but I got the same error.
I believe I have found a solution to this problem. None of the solutions above worked for me. I think the root cause of this issue is that GitHub has ended support for password authentication on August 13, 2021. Instead a personal access token needs to be used.
The steps to solve this issue are as follows:
Create a personal access token on GitHub.com. Tutorial here
Go back to Visual Studio Code and open terminal. Type in the following command with your own user information:
git remote set-url origin https://<TOKEN>#github.com/<user_name or organization_name>/<repo_name>.git
In case you would like to follow a video guide, this one proved to be quite helpful.
I solved it by following Caching your GitHub password in Git.
The steps are as follows:
Download and install Git for Windows
Run Git Bash, 'cd' to the repository directory and enter git config --global credential.helper wincred
It happened to me after GitHub changed its policy on 13 August 2021 to authenticate using a personal access token (PAT) instead of a password.
I did these steps for myself. I am on Lubuntu 20.04.
Created .gitconfig in my home directory and added the following
[user]
name = {your github username}
email = {your email}
[credential]
helper = store --file ~/.git-credentials
Created .git-credentials in my home directory as you can see above and added the following
https://{your github username}:{your github PAT}#github.com
Final step: Restart your terminal and voilà! Try to commit/push/pull in an existing Visual Studio Code Git folder and everything will work as before.
Security Issue
Your personal access token (PAT) will be exposed as clear ASCII text and can be read if anyone has access to your user account.
I had the same issue with my Visual Studio Code on Linux cloning a Visual Studio Git repository.
It was Solved by setting up the Alternate Authentication Settings under security settings on {your-account}.visualstudio.com
Screenshot:
Configure VS Code Github authentication using Github CLI, gh.
Download and install gh here
After installation, open vs code terminal and login to github with gh auth login
You'll be prompted to choose an authentication method. Available authentication methods are password and personal access token. I'd recommend using a personal access token because your authentication details will be stored in plain text on your local machine. Here is a tutorial on creating a personal access token. You can then generate a personal access token here. Ensure your personal access token have the minimum required scopes repo, read:org, workflow
Paste your personal access token and gh will handle the rest.
If you've gone through the above steps before but your personal access token has expired, you can simply generate another personal access token and paste inside the /home/<user>/.config/gh/hosts.yml file. Note that this file path is for linux/MAC users. Windows users should be able to locate similar path in their filesystem.
In case of using VSCode git graph's buttons that result in message error like this:
Unauthorized fatal: Authentication failed ... unable to fetch from remote(s)
This worked for me:
git remote set-url origin "<the git you want to clone/pull/fetch>.git"
Enter your email & password in VSCode pop-ups
Now you can use git graph or cmd normally again
git remote set-url origin https://USUARIO:SENHA#bitbucket.org/URL.git
worked for me!
I faced a similar problem. I was coding in vs code. So, I just tried another terminal to push my code and it works for me!!