24

Git is throwing error

"C:\Program Files (x86)\Git\bin\git.exe" push -u --recurse-submodules=check - 
-progress "origin" refs/heads/dev_civaplugin:refs/heads/dev_civaplugin
remote: Password authentication is not available for Git operations.
remote: You must use a personal access token or SSH key.
remote: See https://github.build.ge.com/settings/tokens or 
https://github.build.ge.com/settings/ssh
fatal: unable to access 
'https://github.build.ge.com/108012572/NextGenUT.git/': The requested URL 
returned error: 403
Done

 Press Enter or Esc to close console...

I cloned remote repository successfully using git extention and able to create new branch also but when tried to push my changes its throwing above error.

I created public and private key using Tools> putty> generate or import key my pc don’t have > .SSH folder in user In git hub I created Personal access token also using Settings > Developer settings > Personal access tokens Not getting clear idea of what the issue is, any input is a great help

2 Answers 2

45

Go to step #6 directly [follow from step #1 if you have single sign-on]

  1. Generate an SSH key in your local machine (enter passphrase while creating key)
ssh-keygen -t rsa
  1. Copy the public key which starts with ssh-rsa
  2. Go to Github > settings > SSH and GPG keys
  3. Click on New SSH key and paste the private that you've copied earlier, and create it

enter image description here

  1. Now, enable SSO and authorize your org

enter image description here

  1. Make sure that the newly created ssh private key is added into the SSH authentication agent
ssh-add <your-private-key>
(e.g., ssh-add id_rsa)

Note: By default, it will have your id_rsa primary key only; so, you need to add your custom private key in it.

2
  • 4
    Correction to Step 2: Copy the public key (NOT private) which starts with ssh-rsa. The public key file should end in .pub; the private key should lack any .pub file ending and its contents should clearly show -----BEGIN OPENSSH PRIVATE KEY-----. DO NOT EVER give your private key to 3rd parties such as Github. -- Also, since you should only be pasting your public key, you don't have to blur out the summary info about that public key as long as your private key isn't compromised. Jul 29, 2021 at 19:25
  • 2
    I have followed this tutorial, and successfully added my private key to GitHub. But when using: git push https://<GITHUB_ACCESS_TOKEN>@github.com/<GITHUB_USERNAME>/<REPOSITORY_NAME>.git My password is still demanded, and the prompt ask for a token identification. remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information. Has anyone experienced the same issue? May 13, 2022 at 15:33
14

See your git remote show origin — you have URL for the remote origin as https://github.build.ge.com/108012572/NextGenUT.git/. HTTP(S) protocol certainly doesn't use SSH keys, for SSH keys you have to change the URL to use ssh:// protocol. Or you have to pass your Github name in the HTTP(S) URL. So either

git remote set-url origin https://[email protected]/108012572/NextGenUT.git

to use Github token or

git remote set-url origin ssh://[email protected]/108012572/NextGenUT.git

to use SSH keys.

4
  • 1
    "HTTP(S) protocol certainly doesn't use SSH keys" Thanks, that's the bit I was missing
    – wip
    Feb 18, 2020 at 5:50
  • 1
    For me the only syntax that worked was (using your example): git remote set-url origin [email protected]:108012572/NextGenUT.git
    – Chaarmann
    Oct 11, 2022 at 11:58
  • @Chaarmann git remote set-url origin ssh://[email protected]/108012572/NextGenUT.git should also work.
    – phd
    Oct 11, 2022 at 14:57
  • Ya. For me also only worked without the 'ssh://' part. Not sure why. Dec 20, 2022 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.