0

I am newbie with github and meet this problem.]

I used an old user name like this ab2903 and the new user name is aquajp

I want to use the new user name to upload my project to github.

I use this command to clear , and remove all what involve to the old user

rm -r -f .git

I think that I can upload use the new user name, but when I upload using the command they gave me, I had this error :

remote: Permission to aquajp/106navbar.git denied to ab2903.
fatal: unable to access 'https://github.com/aquajp/106navbar.git/': The requested URL returned error: 403

What happend ? I really do not want to involve with that username anymore.

Could you please help me how to delete all what that username did in my computer (my computer is Mac OS)

Thank you in advance.

1 Answers1

1

I used an old user name ab2903 and new user name aquajp ... and I want to use the new user name to upload my project to github.

OK. Be aware that when you run git push, Git does not make any claims about who you are to GitHub. It's some other thing that makes the claim about who you are.

That "other thing" can be:

  • https authentication: when you use https://user@github.com/aquajp/106navbar.git as the URL for your git push, it's the user@ part that is making the claim. So be sure that the URL lists the new name, not the old one, in the user@ part. If the URL does not list a user@ part (or, for that matter, a password—which GitHub will reject anyway—or access token), Git will also invoke a credential helper; see below.

  • ssh authentication: when you use ssh://git@github.com/aquajp/106navbar.git as the URL for your git push, nobody makes any claim about who you are. GItHub guess who you are based on the public key ssh sends. So to be sure that ssh sends a public key registered to aquajp, make sure your ssh setup sends such a public key.

Except for choosing the URL itself, and then which credential helper(s) to use with https:// URLs, you don't set the credentials up in Git at all. You set them up in these other program(s). On macOS, there are macOS-specific credential helpers, and if you are using https:// URLs, see https://docs.github.com/en/get-started/getting-started-with-git/updating-credentials-from-the-macos-keychain for more.

If you are using ssh authentication, the situation is more complicated in some ways, but generally much easier to use once you set it up correctly. For background explanation, see Connecting to GitHub with SSH to a project located not in my account and (more detailed) Git not using local repository credentials. In this case the problem is that the public key you're sending is associated with the old user name ab2903. If you have log-in access on GitHub to that account, you could log in there and delete that public key so as to remove it, but in any case you can simply generate a new public-and-private key-pair on your mac using ssh-keygen. See the more-detailed answer to make sure that you're telling your macOS ssh command to send the new public key, once you've uploaded that new public key to GitHub using the new aquajp user name.

torek
  • 448,244
  • 59
  • 642
  • 775