Unable To Clone Azure DevOps Repo From VSOnline - visual-studio-code

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?

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.

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

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:

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!!

First time using github and want to know command to access a repository

I just installed github in ubuntu and i don't know the commands to login with my username and password and command to access a repository and work on it
Thanks
Best way for linux is probably to give github your public key in your settings page, rather than log in as such. Then you can add a github repository to your local repository with git remote add git#github.com:<repopath> and push/pull from it with git push and git pull respectively using SSH for authentication instead of username and password.
If you don't understand any of what I've just said, I'd recommend looking at some tutorials, like this GitHub help article or Try Git.