I am part of an organization that uses SSO in Github. I don't have problem to access the repository through the web, it redirects me to SSO login and that's all.
The problem started when I logged-in first to my personal repository on GitHub through Git-Bash, I did some changes and then I wanted to do changes in a repository from my organization. When I run the below command, it wrote me that I need to re-authorize the OAuth Application, but I don't understand how:
$ git push --delete origin v0.1.3
remote: The `<my_company>' organization has enabled or enforced SAML SSO. To access
remote: this repository, you must re-authorize the OAuth Application `Git Credential Manager`.
fatal: unable to access 'https://github.com/<my_company>/myproj.git/': The requested URL returned error: 403
How can I re-authorize the login?
I tried to re-open Git-Bash but it wrote me the same error.
My company just enabled SSO for my Github Org overnight so was getting the same error running git pull. I fixed this with the following steps.
Open Credential Manager in Windows and delete the existing credential for github.com
Re-initialise the cred manager in git bash: git config --global credential.helper manager-core
Re-run git pull and follow the pop-up instructions to authenticate in a browser (which happened automatically for me with SSO).
After those steps git commands worked for me again.
I used the Github cli by running the following in the terminal
gh auth login
which then prompted me to re-authenticate, and I was able to.
If you do not have the CLI (Command Line Interface) currently installed, you can visit https://cli.github.com/ for more information. There is a download for Mac.
For VSCode users or any other IDE you need to re-authorize the app!
Go to your settings on GitHub -> Applications -> Authorized OAuth Apps,
Search for "GitHub for VSCode", and choose "Revoke" from the "..." menu.
If you then sign out in VSCode and sign in again, you should be prompted to re-authorized
Delete git from "credential manager" window's application. Then pull on repo again. The sso authentication should automatically come up.
This works for me by revoking the current application in the Github Settings > Settings > Applications > Authorized OAuth Apps
and then try the git pull again.
Related
I use the git integration with VSCode and got the notification today that I need to renew my access token. I did so and have my new token (which I obtained through the web interface). Now I need to set my local git configuration to use the new token instead of the old one which will expire in a few days.
The VSCode docs suggest the following:
To execute the 'GitHub: Set Personal Access Token' type Ctrl+Shift+p in VSCode to open the command palette and type 'GitHub: Set Personal Access Token'. You will then be prompted to enter the token generated from GitHub.
This option isn't available in my git integration in VS code (maybe I need an update?)
How can I do this from the command line?
If you want to update Github Personal Access Token in VSCode, you need to install Github Extension
You can also update Github Personal Access Token via command line
Open a command line and set the current directory to your project root
Run the command to set remote access via a token
git remote set-url origin https://username:token#github.com/username/repository.git
Example:
git remote set-url origin https://exampleuser:b8c28127***63gu56b2d#github.com/exampleuser/exampleproject.git
Not sure if you are running on windows, but modern git binaries are using windows credential manager to store the GitHub / Git authentication details. To modify them, go to the windows "credential manager". The procedure is detailed here: https://www.sqlservercentral.com/blogs/changing-git-credentials-in-windows
I created a new branch manually from Xcode, which for some reason did not show up on the repository, so I made another branch from the GitHub browser manually. Then when trying to commit I'm met with the error:
"The remote repository rejected commit. Make sure you have permission to push to the remote repository and try again."
I've talked to my boss who ensured that I'm given written permission, so we're both confused as to why I can't commit properly.
If you have this option selected in the Email Settings page of GitHub it will prevent you from pushing.
You need to go in to terminal, and then go to your project directory and type these commands.
xcrun git config user.name "your username here"
xcrun git config user.email youremail#somedomain.com
Make sure the user name and emails are the exact ones that you use on github, gitlab etc.
I was using "Personal Access Token" for authentication and was facing the same issue. For some reason, generating a new token and entering it again in Xcode -> Preferences -> Accounts fixed it.
I'm using the latest Github for Mac as a new Git user. When I try to sync a repo (that I first cloned, then created a new branch, commited changes, and then merged with master), I got the error:
Authentication Failed.
You may not have permission to access repo111. Check Preferences to make sure you’re still logged in.
I searched for similar questions, but the answer seemed to be add SSH keys to github, so I followed: https://help.github.com/articles/generating-ssh-keys.
When I do ssh -T git#github.com, I get:
Hi User111! You've successfully authenticated, but GitHub does not provide shell access.
I'm logged in as the correct user, and have rights to the repo, so I'm not sure why I'm not authenticated?
It could be that you entered a password incorrectly and it's stored in your keychain.
For my situation, I was using GitHub for Mac to work with a BitBucket repository. Long story short, I mistyped my BitBucket password and GitHub for Mac could not authenticate (because the password stored in my keychain was wrong).
Thanks to the helpful folks at GitHub, they quickly responded when I asked for help:
Open Keychain Access.app (in /Applications/Utilities) and search for "GitHub for Mac." There should be an entry like "GitHub for Mac — bitbucket.com". Delete that entry
Steps to fix if using GitHub for Mac to manage a BitBucket repo
If you see this:
… then you might have a BitBucket keychain/password problem.
Open Keychain Access.app (in /Applications/Utilities) and search for bitbucket:
Right-click on the entry and get info:
Click on "Access Control" to confirm that it's truly the GitHub for Mac BitBucket password/login keychain item:
Rather than deleting the keychain entry/item, I just edited my password:
You should now be able to use GitHub for Mac without authentication failures. :)
Had the same problem, but it was not a password problem, since other repositories worked just fine.
Finally compared .git/config with a working repository and found this:
This failed:
[remote "origin"]
url = github#github.com/path/to/repository
This worked:
[remote "origin"]
url = https://github.com/path/to/repository
Still have no idea how or why this changed.
I had to try some other stuff after the solutions above didn't work out for me.
Dont know why I got this issue, or why was fixed after:
deleting the existing keys:
.ssh/github-rsa
.ssh/github-rsa.pub
restarting GitHub Desktop, which automatically regens the keys
add new keys to repo host (bitbucket etc)
I had the same problem, then I followed this steps:
Login to BitBucket and go to the repository you want to use
Click the “Clone” button, and change the drop down option to HTTPS.
Copy the command that appears (something like: git clone https://username#bitbucket.org/team-name/repository-name.git)
Open terminal in your mac and navigate to wherever you want the theme files to be stored.
Paste the clone command in the terminal, press enter and then enter your password when requested.
In Github for Mac go to the repositories screen and click the + sign in the status bar.
Select Add Local Repository – and then select the repository of the folder you want to add.
Done
If you have created remote repository on GitHub and merged with local repository or project .
you can add that local repository to GitHub desktop app
than go to Repository > repository settings > Remote >
under remote You'll find primary remote repository (origin)
there's a ssh remote url delete that And
Go to your GitHub account.
Open Your Remote repository
click on Clone or Download
Copy the https URL
paste that in the GitHub desktop app
click on fetch in the Desktop GitHub App
It'll work Great :)
If your password is correct and you still see have this problem, chances are your .git/config file has some miss configuration.
In my case, it had a pushurl value under [remote "origin"] which was not needed (I was working on a cloned project).
Comment that line by adding a # before it and you are good to go :)
Also, if you get an error saying:
This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push
just delete that by doing
rm .git/hooks/pre-push
now you are all set. This happened to me also using github desktop app for mac, with a remote bitbucket repo.
hint: if you commit changes and refresh bitbucket to see the changes, those might not show, but navigate to the root of the project and then back to the file and you'll see the changes. Probably some cache issue but it can drive you mad if you don't know this hint.
I am trying to gain access to the embedded git repository for an existing Google Developers Console (GDC) project. The GDC shows the git repository under -SOURCE CODE-Releases. I followed the official gcloud installation instructions to the point:
gcloud auth login /* pulls up browser and does authentication just fine */
gcloud config set project <project>
gcloud init <project>
The latter always results in the following (replacing actual project name with 'fishbone'):
$gcloud init fishbone
Initialized gcloud directory in [/Users/dummy/Workspace/fishbone/.gcloud].
Cloning [https://source.developers.google.com/p/fishbone/r/default] into [default].
Initialized empty Git repository in /Users/dummy/Workspace/fishbone/default/.git/
fatal: remote error: Invalid username/password.
You may need to use your OAuth token password; Note that generated google.com passwords are not compatible with private repositories
ERROR: Unable to initialize project [fishbone], cleaning up [/Users/dummy/Workspace/fishbone].
ERROR: (gcloud.init) Could not fetch repository.
Only on the very first installation of the SDK (re-tried more than once now), I remember gcloud init asking for a username. Never again after this. Mac OS X 10.9.3 and:
$git --version
$git version 1.8.5.2 (Apple Git-48)
I am aware of this related gcloud init issue, but it's not this. Help greatly appreciated.
Go to https://console.developers.google.com/project/your-project-id > Source Code > Browse > Find this line : "Alternatively, instead of using the Google Cloud SDK to manage your authentication, you can manually generate your Git credentials by following this link." > Click "following this link" and you can see your git password. As you can see in your error, google password are not compatible with private repositories. Now you can :
Use your gmail and git password above to clone reposite.
Or create .netrc file at your home folder and add : "machine source.developers.google.com login your-email#gmail.com password 1/abxxxxxxxxxxxxxxxxxxxxxxx" to this file. It will not request your password again.
Just goto your Google Developer Console and click /
find the content like below
"Alternatively, instead of using the Google Cloud SDK to manage your authentication, you can manually generate your Git credentials by following this link."
and click "following this link" then follow the instructions on that page.
Thats all.
They moved the options to manually created Git credentials. The options are now under GCP -> (tools) Development -> Source Code
and under the options when cloning new or existing repos they give you the option to use gcloud or create your own credentials.
also below in screenshots
Every time I try to push a repository in GitHub with Pycharm the it fails.
Push failed: fatal: Authentication failed for 'https://github.com/(my github repository)/'
In Settings->Version Control->GitHub, I filled the fields Host, Loging and Password (Auth Type: Password). Testing it: "Connection successful"
In Settings->Version Control->Git, Path to Git executable is seted with the full path, SSH executable: Buil-in
Pycharm version 3.1.1
Git version 1.8.4.msysgit.0
On Win 7.
I tried all but it worked me charm :
The problem I had : Every thing was working from terminal and from Github desktop as well.
But when I tried to PUSH/PULL from pycharm it wasn't working.
Reason : It happens because by-default pycharm save password locally in DB.
Work around: Go to File > Settings > Appearance & Behavior > System Settings> Passwords, clicked on 'Do not save..", restarted IntelliJ and VCS asked for password again.
It seems there is some issue (if using https) if username or password contains "some" special characters.
So, I've generated a secondary password ("personal access token") in GitHub's application settings page (using the "Create new token" button), I did copy this token. Then I've selected Auth Type: Token in Settings->Version Control->GitHub, and pasted the token.
Testing it: Connection successful for user . Now the git push works perfectly.
I struggled with this problem for half a day using Git in PyCharm.
Solution: Settings => Version Control => Git => ticked "Use credential helper" and then it worked perfect.
If your username or password has special characters, you can replace it with the Percent-encoding for theses characters.
for example, if your password is "test#2010", you will write it as "test%402010" and the config command will be like this
git config remote.origin.url https://{username}:test%402010#github.com/{repo_username}/{repo_name}.git
So I found the solution to my problem, and I hope this helps:
If you are using KDE, or Gnome, your "KDE Wallet", or "Gnome Keyring" manager will save your password when you push for the first time. However, if you enter the password wrong, these managers (ksshaskpass for KDE) will store the wrong password and will send the wrong password every time.
To fix this, open the appropriate manager and change the password. With KDE, it is in: Kick-off-menu > System Settings > Account Details > KDE Wallet, then click "Launch Wallet Manager", and find "ksshaskpass", expand it, and then expand "Passwords", then find your github registered email address there, click it, and on the right, click on "Show Contents". Now change that value (in case wrong password), then hit save. and you're done!
Now that means you don't have to type in your password each time for https push, and you don't have to use SSH keys either ;)
I came across this once. Turned out that the Web Credentials in the Credentials Manager stored an incorrect password for github.com and gitlab.com.
I removed that and it gave me the option to log in when I added a new repository.
Ok guys, I tried all suggested solutions and they did not worked for me.
I use git bash and bitbucket.
Finally I turned it upsidedown, and it worked - at least that way. I know this is difficult and foolish solution, but it worked.
So the steps:
you have your code on your local machine.
you have your repo /on bitbucket/
Delete your repo or make a new one with new name
Make a readme.md with the help of the /bitbucket's/ dashbord
clone the new repo
copy your files into this new folder which you want to push
do the git bash work (add,commit) and push it to the repo.
In PyCharm go to:
Settings > Version Control > Github > +
add credentials
AND:
Check your open browsers, when logging in from pycharm into GitHub a tab is opened to authorize Jetbrains the access to your Github account.
I am using High Sierra on an old iMac and originally tried to push a new local project to a new remote.
Unable to get authentication working on Terminal I then tried to use PyCharm as a vehicle to save the authentication token from Github.
In the past I was accustomed to the IDE prompting for the use of a token and even suggesting me to open Github.com to generate the appropriate one.
PyCharm was not able to push a new branch but it did not give any such hints for a solution in the error message
12:56 Push failed
git#github.com: Permission denied (publickey).
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Show details in console
My solution was to go into the settings and there I found the connection to Github unset - and I was able to link a token.
But I also had to set the remote with the HTTPS link. When I tried with the SSH URI it did not work.