简体   繁体   中英

I setup a new GitHub account. Then I use the new GitHub account to build a new repository, but I can't push

remote: Permission to Coderlll/etstSSSSSH.git denied to oldGitHubAccount.
fatal: unable to access 'https://github.com/newGitHubAccount/etstSSSSSH.git/':
The requested URL returned error: 403

The oldGitHubAccount is my first GitHub account.
I use the account named oldGitHubAccount to update my old Github account is OK.

I have added the new SSH with the new email.
What's the reason?
How can I do to solve this issue?

Check you git configurations.

git config --get user.name
git config --get user.email

You must set it to your new account.

Also use git SSH protocol (git@) instead of the HTTPS, so it will use your SSH key.

You can either:

  1. Either change your remote URL to use the SSH protocol with public / private key pair, then the stored credentials are obsolete for this repository
  2. Make your credentials storing mechanism forget about the old account (git doesn't cache the credentials itself by default but it can delegate to other credentials storing mechanisms)
  3. Give your old user push-rights by making it a collaborator in the new repository. The commits will still be attributed to your new account, if you used the right E-mail address when committing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM