How to solve Permission denied (publickey) error when using Git?

后端 未结 30 1858
野性不改
野性不改 2020-11-22 08:07

I\'m on Mac Snow Leopard and I just installed git.

I just tried

git clone git@thechaw.com:cakebook.git

but that gives

30条回答
  •  旧时难觅i
    2020-11-22 08:10

    Guys this is how it worked for me:

    1. Open terminal and go to user [See attached image]
    2. Open .ssh folder and make sure it doesn't have any file like id_rsa or id_rsa.pub otherwise sometimes it wont properly rewrite files
    3. git --version [Check for git installation and version]
    4. git config --global user.email "your email id"
    5. git config --global user.name "your name"
    6. git config --list [make sure you have set your name & email]
    7. cd ~/.ssh
    8. ssh-keygen, it prompts for saving file, allow it
    9. cat ~/.ssh/id_rsa.pub [Access your public key & copy the key to gerrit settings]

    Note: You should not be using the sudo command with Git. If you have a very good reason you must use sudo, then ensure you are using it with every command (it's probably just better to use su to get a shell as root at that point). If you generate SSH keys without sudo and then try to use a command like sudo git push, you won't be using the same keys that you generated

提交回复
热议问题