Re-authorize the OAuth Application in GitHub CLI - github

I'm part of an organization, so I'm trying to clone a repo that is inside of that organization but every time that I've tried I get this error:
Cloning into 'diretory'...
remote: The `X' organization has enabled or enforced SAML SSO. To access
remote: this repository, you must re-authorize the OAuth Application `GitHub CLI`.
fatal: unable to access 'https://github.com/X/Y.git/': The requested URL returned error: 403
Have you ever had a similar problem?

What fixed it for me was to open the Credentials Manager of Windows and delete all GitHub-related entries. Then on my next interaction with GitHub, from Visual Studio in my case (should be similar for GitHub CLI), I got a prompt to sign in and after that, it all worked fine.

Related

VS2022 Authentication fails when pushing code to github

I am having the below error when pushing code to github
remote: No anonymous write access.fatal: Authentication failed for 'https://github.com/username/repo.git/'
Tried resolving by doing the following by doesnt resolve the issue
setting origin to https://personalAccessCode#github.com/username/repo.git
--> prompt to login using browser login, code, token
--> tried all and all didnt work
setting origin to https://username:personalAccessCode#github.com/username/repo.git
--> prompt above error when push
Anyone have encounter this on VS 2022 community edition?
Thank all for your help. I managed to successfully push code to git after removing a global settings that set the PAT access token which I use it to connect Azure DevOps
git config --global http.extraHeader
First, the URL should not include your token (you can include your GitHub user account name).
Second, VS2022 has an integration with a Git credential helper: check if your is set to GCM (or GCM Core, even though GCM Core has been replaced by GCM).
Both GCM or GCM core are packages with the latest Git for Windows, so make sure to use the latest one.
Below is the result I have got after changing URL and credential-helper as suggested. But still having the same error

Github actions failing because of 'Bad credentials'

I am running a github action aimed at our company's Github Project board but it is always failing with This project is configured at the org level. Org Login:[our organization name], project number#1 #ERROR# HttpError: Bad credentials
Run konradpabjan/move-labeled-or-milestoned-issue#v2.0 with:
project-url: https://github.com/orgs/[our project name]/projects/1
column-name: Waiting
label-name: blocked
columns-to-ignore: Review,Ready 2 Merge,Done
I have a personal access token that has all rights, which seemed to be the solution in other projects.
It could be that I am missing some config that involves a token but I am not seeing anywhere online where i could fix this.

Unauthorized Response from Azure DevOps

Our client is using for Azure DevOps for code repository. I've been able to connect and pull/push code for a year without issue.
I started on a new project for this client that uses the ADO Artifacts for a NuGet store. My windows login for this project is different than my ADO account so when I build the solution in VisualStudio I get asked for credentials for the NuGet store. I enter my credentials and it immediately asks me again for creds. It does this 4 or 5 times then finally fails.
Minutes to hours later, I can no longer pull/push code from the Git repos. I've tried switching to a PAT but same result. I can get into ADO through a browser and see the repositories. I'm an org admin but can't see users and permissions during this time. If I wait a few hours, it will start working again. I verified my user is NOT locked in AzureAD. I get denied on all devices (on and off client network).
I think I've fixed the issue of the NuGet authentication but does anyone know if there's a "lock out" feature in ADO that I'm missing? If so, is there a way to "unlock" the user when this happens.
The error I get back in Git seems to be a standard failed authentication:
fatal: Authentication failed for 'https://****.visualstudio.com/DefaultCollection/projectname/_git/repo-name/'

Azure Devops clone This is not a valid source path in source tree

I have managed to finally add my devops account in sourcetree using the https://orgname.visualstudio.com path
Now I am having issues cloning the repository
I am using the path that devops gives me
https://orgname#dev.azure.com/orgname/MyProject/_git/MyRepo
but I get an error saying
This is not a valid source
The details reveal authentication issues... Yet it authenticated fine when adding the account.
What is going on? Does the azure account have to be the default account?
I managed to fix this by changing from the sourcetree embedded git to my system git Tools>Options>Git>Git Version>Select System. Afterwards when trying again it prompted me to login on my organization domain with 2 factor as if logging in on the devops web app directly.
My system Git is using manager-core for the credential management which is probably not the same system which the embedded version used.
I tried the above solutions (and more) but for me what in the end solved the problem was that the git-password I first wrongly entered when I tried to access the repo had been saved in Keychain (MacOS) and when I tried again this password was used without giving me the option to type it in again. I deleted the password to the Azure DevOps project in Keychain and then got prompted to enter the password again whereafter I pasted the Personal Access Token (!!) generated in Azure Devops and it finally worked!
It could happen when you entered wrong credentials and you don't get asked again, try this:
Go to : Sourtree->Preferences->Advance (tab)
Under: "Default usernames for URLs which do not include one:" delete your wrong credentials.
Try accessing your repo again with right credentials.
This is not the issue which caused by Azure devops. No matter https://xxx.visualstudio.com, or the URL which like dev.azure.com, they should all available git source.
For me, I just try with multi different git URLs, and found the few of URLs are failed with same error with you. But it prompt This is a git repository after I exit the SourceTree and re-configure the clone with same URL which encountered the error previously.
This seems be the most common Sourcetree problem which encountered by many users, not just the URL of azure devops that you occurred.
Check this thread, and try with its recommend way:
Open source tree, Tools -> Options -> Click on Git Tab -> Update
Embedded Git.
Or, consider the method I used: exit the Sourcetree, and re-configure the clone with same URL. (Not recommend since this can not permanently solve this issue)

Jenkins giving Permission denied (publickey) on adding github repo

I am using Jenkins Github plugin and was using public/private key for one repo, which was working alright. But I got problem when I added another repo, because github doesn't allow sharing public key across multiple repos.
So i integrated jenkins using github token (in Jenkins > manage > configure system and service in github) and removed private/public keys in jenkins server and github. Now when I add repo, I get Permission denied (publickey) error (image attached)
How do i integrate multiple github repos with my jenkins server?
Found the problem. There is key attached to account of user who's token was added to jenkins. My assumption was it should not have mattered as token was added. But that's not correct.
Added private keys of user who's token was used, in jenkins server and everything returns to normal
Got hint from Authenticate Jenkins CI for Github private repository