Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 944
Sijith Avatar asked Aug 01 '18 13:08

Sijith


People also ask

What is personal access token and SSH key?

While SSH keys can be read-only or read-write enabled, or scoped to specific repositories, personal access tokens do have an edge in terms of their finer-grained permissions model in comparison. This is likely why GitHub recommends tokens over SSH keys.


2 Answers

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.

like image 50
Prashanth Sams Avatar answered Sep 18 '22 16:09

Prashanth Sams


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.

like image 43
phd Avatar answered Sep 20 '22 16:09

phd