-1

I have generated the SSH key and updated the same in the Git repository. Later tried to push the code but end up with the following error. I tried the workarounds associated in stakeoverflow and in google as well but not solved. Could please advise.

remote: Password authentication is not available for Git operations. remote: You must use a personal access token or SSH key. remote: See https://github.xxx.com/settings/tokens or https://github.xxx.com/settings/ssh fatal: unable to access 'https://github.xxx.com/abcd/code.git/': The requested URL returned error: 403

Thanks.

phd
  • 82,685
  • 13
  • 120
  • 165
Bhaskar
  • 271
  • 7
  • 20
  • Does this answer your question? [Github enterprise - remote: Password authentication is not available for Git operations](https://stackoverflow.com/questions/45903106/github-enterprise-remote-password-authentication-is-not-available-for-git-ope) – phd Jan 02 '20 at 13:49
  • https://stackoverflow.com/search?q=%5Bgithub%5D+remote%3A+Password+authentication+is+not+available+for+Git+operations – phd Jan 02 '20 at 13:49

2 Answers2

4

It's because you have cloned your repository with default https and added an SSH key to your repo. You can do git remote set-url origin git@github.com:username/repo.git which resolves your problem.

Sam
  • 572
  • 3
  • 11
1

Github clone via https doesn't allow SSH key, so you can switch to the git clone git@github.com/username/code.git.

As pointed out in their document:

The https:// clone URLs are available on all repositories, public and private. These URLs work everywhere--even if you are behind a firewall or proxy. In certain cases, if you'd rather use SSH, you might be able to use SSH over the HTTPS port.

When you git clone, git fetch, git pull, or git push to a remote repository using HTTPS URLs on the command line, you'll be asked for your GitHub username and password.

The point is: When you git clone, git fetch, git pull, or git push to a remote repository using HTTPS URLs on the command line, you'll be asked for your GitHub username and password. No SSH key will be used.

It also puzzles me for weeks.

youkaichao
  • 1,938
  • 1
  • 14
  • 26