Sijith
Sijith

Reputation: 3932

Git push is not working Error "You must use a personal access token or SSH key"

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

Upvotes: 28

Views: 102519

Answers (2)

Prashanth Sams
Prashanth Sams

Reputation: 21129

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.

Upvotes: 55

phd
phd

Reputation: 94483

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.

Upvotes: 15

Related Questions