1

I work on a lot of machines and most of them are not mine. So, these machines are already set up with the ssh-key to those guy's GitHub account. Now, I want to work on that machine and then push the code to my GitHub account. But when trying to do so I get a warning saying remote: Permission to mukul/repo.git denied to NewUser . The requested URL returned error: 403

I know that I can set-up these machines with my GitHub account, but I guess that's not feasible (at least not ideal). I tried googling but it seems to filled with the posts answering the question of how to get rid of username and password thing i.e setting up ssh-key for smooth development experience.

But I want the GitHub to ask me for the username and password. As a quick fix, I tried to locally change the git config for that repo, but it doesn't seem to be working.

Mukul Kumar Jha
  • 1,062
  • 7
  • 19
  • I had a similar question which turns out to be duplicate of some other question :) https://stackoverflow.com/questions/68794860/i-can-login-to-github-with-my-username-and-password-but-can-not-push-code-with-t – iRestMyCaseYourHonor Aug 16 '21 at 20:41
  • @iRestMyCaseYourHonor yeah GitHub has deprecated authentication based on username and password :/ – Mukul Kumar Jha Aug 18 '21 at 06:23

1 Answers1

0

But I want the GitHub to ask me for the username and password.

Then use an HTTPS URL instead of an SSH one (which would be default authentication with the ~/.ssh/id_rsa existing private SSH keys, registered to the other GitHub account)

Make sure your git config credential.helper is empty, or, if it is not (for instance, on Linux), check if the credentials are already cached.

For osxkeychain, follow "Updating credentials from the OSX Keychain".
Or, as I explained here:

git credential-osxkeychain erase https://github.com
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250