A Case,

Over the years, I have disabled my Github account (the previous learning time, coupled with the previous code quality is not high), so I created a small account to practice, and then some strange problems appeared, such as:

  1. This parameter is displayed when you switch the SSH key from the old Github account to the new github account on the same computer403The problem,
  2. Unable to push two projects to two Github accounts on the same computer.

Ii. Solutions:

1. No longer push code to the old account, only push code to the new account

Delete your SSH key from your old Github account, add it to your new Github account, add the remote repository from your new account to your current push project, and change your Git credentials

Git config credential. Username New Github account // Git config credential. Username new Github account //Copy the code

This should be enough, but if not, generate a new SSH key and try again.

Remote URL is HTTPS, should be git@xxx, error message, as follows

Projects developed before 📢 📢 📢 with old accounts can still be submitted normally

2. One computer can push code to two accounts.

If the SSH key is placed directly under two Github accounts, the push code will prompt a problem with [Figure 1] 403

Main reason: Multiple accounts can’t be added with the same public key. If github can’t tell which user is logging in securely, then the secure login will have no effect. If you can log in, I can log in, and the server can determine who is logging in securely.

So what to do?

🔽 🔽 🔽

  • Generate a new SSH key

  • The generatedid_rsa_it.pubAdd a new Github account under
  • Configuration. SSH/config

  • Change the remote URL of the project pushed to the new Github account.githubReplacement forgithub-it

  • Push the code

Three, reference

  • Git ERROR: Permission to XXX. Git denied to user
  • Remote: Permission to xxxxx.git denied to xxx. fatal: Unable to acc