问题:
remote: Permission to beijing01/learn_github.git denied to liuhongyang02. fatal: unable to access 'https://github.com/beijing01/learn_github.git/': The requested URL returned error: 403
To see what your remotes are you can run:
git remote -v
产生故障的原因是本地密钥和github上不同 解决方法:
Checking for existing SSH keys
- Open Terminal.
- enter ls -al ~/.ssh to see if existing SSH keys are present
- Check the directory listing to see if you already have a public SSH key.
If you don't have an existing public and private key pair, or don't wish to use any that are available to connect to GitHub, then generate a new SSH key.
If you see an existing public and private key pair listed (for example id_rsa.pub and id_rsa) that you would like to use to connect to GitHub, you can add your SSH key to the ssh-agent.
Generating a new SSH key and adding it to the ssh-agent
Open Terminal. Paste the text below, substituting in your GitHub email address.
This creates a new ssh key, using the provided email as a label.
When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
At the prompt, type a secure passphrase. For more information, see "Working with SSH key passphrases".
Adding your SSH key to the ssh-agent
Start the ssh-agent in the background.
If you're using macOS Sierra 10.12.2 or later, you will need to modify your ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain.
Add your SSH private key to the ssh-agent and store your passphrase in the keychain. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.
Adding a new SSH key to your GitHub account
Copy the SSH key to your clipboard. If your SSH key file has a different name than the example code, modify the filename to match your current setup. When copying your key, don't add any newlines or whitespace.
问题: 错误提示:fatal: remote origin already exists.