Azure Devops git credentials not authenticating when try doing git pull - azure-devops

I've set up a git repo in Azure Dev Ops and I'm trying to do a git pull to my computer via https. I set up a credential alias in Dev Ops (this seemed to be the only authentication method that worked for pulling originally).
When I pull to my computer I'm being prompted for the alias password (which is definitely correct, as is working on other computers). When I enter the password I'm getting the following error message:
fatal: Authentication failed for [git url]
Does anyone know what might be causing this?
The email address linked to the Dev Ops account has been added to the team members in Dev Ops (this was causing issues with git pulling on another computer, however this resolved that instance of the error)

Related

Github does not ask for credentials

Github does not prompt for credentials
I have a problem with git remote. If i try
git push -u origin main
with github it gives me immediate error "remote: Write access to repository not granted.", not even trying to ask me for my credentials. (a few weeks ago it worked fine).
If i change remote to gitlab and try same it works as should (prompts for login credentials, and if they are correct then pulls).
So where it could be a problem, or something changed in github and http authentication requires something else?

Connect from Sourcetree to Azure DevOps Server 2020

I have a repo in Azure DevOps Server 2020 (on-premise), which contains a lot of files. I'm trying to use Sourcetree to maintain changes in repo.
Sourcetree has an option to setup remote account to connect to ADS. But I cannot connect to ADS, I get strange errors.
I tried using Host URL with only domain, with collection name and even with project name, but no success :(
Settings before clicking "Refresh Personal Access Token".
Then I add my PAT via "Refresh Personal Access Token", I use my ADS username (integrated with Active Directory) and PAT as password:
I get the error after enterring username and PAT:
So my questions:
Is my authenication flow correct?
Should I use only hostname as "Host URL" in Sourcetree or I should add also Organisation (Collection) and Project name?
What should I use in PAT request:
Active Directory username (with domain or not?) and PAT as password?
PAT as username and as password?
PAT as password and no username?
something else?
Sourcetree has an option to setup remote account to connect to ADS.
But I cannot connect to ADS, I get strange errors.
The Remote option is only for Azure DevOps Services, the on-premise Azure DevOps Server is not supported with this option. Something like Bitbucket and Bitbucket Server, they have different authentication methods
E.G The Azure DevOps Services https://dev.azure.com/{org} works as expected:
For on-premise Azure DevOps Server, we can use the Clone option, just copy the specific repo URL from your project, then set the local path to clone. After that you can change your source files on your local repo and push them to remote repo.

VSCode Pull Requests - Organization

I have my personal GitHub account which has been given access to Repos that exist as part of an organization. I'm trying to create a pull-request from within VSCode for these Repos, but I get the below error.
Is there a setting I'm just missing?
[Info] GitHubRepository> Creating pull requests failed: HttpError: Validation Failed: {"resource":"PullRequest","field":"head","code":"invalid"}
HttpError
Check first if you have a git config credential.helper set (to, for instance on windows, manager-core)
If you have, that means the wrong credentials (username/password) are cached in said credential helper. They are not the ones for your organization GitHub account.
See GitHub "Caching your GitHub credentials in Git" and update them.

SSH access to GitHub repository

I have followed the process described in Multiple GitHub Accounts & SSH Config (stefano's answer) and have set up SSH access to multiple repositories using deploy keys. I've tried that on repositories of a specific GitHub organization and it works fine - I can pull and push changes. I've also tried this on my user area and it still works great.
However, when trying this on repositories in another GitHub organization (e.g. when doing a git push) it fails with the following error
ERROR: Permission to XXXX/YYYY.git denied to deploy key
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
When checking SSH access through ssh -T I get
"Hi XXX/YYYY! You've successfully authenticated, but GitHub does not provide shell access."
which suggests that SSH should be working.
I have gone through the organization settings (main page for GitHub organization > Settings) and they have pretty much identical settings, except from what you would expect to be different e.g. contact email etc.
I was wondering if anyone has any ideas about what could be causing this. Are there any more organization settings somewhere by any chance?
ERROR: Permission to XXXX/YYYY.git denied to deploy key
This looks like you are trying to push using a deploy key. This key is used for deployment and therefore only to read-only access of your repository. Make sure you have the key which is enrolled in your github account, make sure it is used (IdentityFile in ~/.ssh/config) and get rid of the deploy key from the standard location which is picked by default (~/.ssh/id_{rsa,dsa,ecdsa,ed25519}). Note, that if there are more "valid" keys, only the firs succeeds.

Why does github keep asking me for repo credentials?

We recently moved our github from one account owner to another, and now all of the sudden when I do a git pull or any git command on the remote repo, it asks me for github username and password.
My git-config says:
[github]
user = kamilski81
token = *********
Any idea how I can stop it asking me for credentials and remember everything, does the new owner have to setup my ssh keys or something of that sort?
Following this article sorted it out for me:
https://help.github.com/articles/why-is-git-always-asking-for-my-password
git remote set-url origin git#github.com:user/repo.git
The github username and token in the gitconfig is only used for interactions with the GitHub API (for instance the hub gem and the github tool).
If you are pushing and pulling from a GitHub repository over https, then you need to specify your credentials every time, or hook into a password manager to remember the credentials for you. How to do this depends on your platform.
The easiest thing to do is to go to your github account and submit your SSH public key to your account, and then switch your github remote to push/pull over ssh instead of https.
[edit] After re-reading the question I noticed that you mentioned it was previously a GitHub repo that was just moved from one owner to another. If that's the case, and you ARE able to push and pull by specifying your credentials, it sounds to me to be one of two scenarios:
The previous remote used ssh, and GitHub has your SSH key; but when the owner changed and you updated the remote, you updated it to go over https.
The previous remote used https, but you had a password manager setup correctly to deal with your credentials, which no longer works.
After doing "remote -v"....the issue was that my remote was using an "https" remote rather than "git" remote. Changing the remote to use git rather than https solved everything.
If you execute only once git pull and Git client still asking you the credential without do the git pull for you, the problem should be because your credential is incorrect or not setup yet.
but if you get the dialog ask for credential one for each operation, it mean that your credential isn't remembered. To do that, you may use Pageant to store your SSH private key, so, everytime you do something, it will retrieve your credential from Pageant instead to asking you.