$ git pull [email protected]: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
However I have my ssh publickey on the local machine and has already added it to GitHub keys.
Then I checked the error logs as is suggested in :
$ ssh -vT [email protected] OpenSSH_7.9p1, LibreSSL 2.7.3 debug1: Reading configuration data /Users/yzy/.ssh/config debug1: /Users/yzy/.ssh/config line 1: Applying options for * debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug1: Connecting to github.com port 22. debug1: Connection established. debug1: identity file /Users/yzy/.ssh/id_rsa type 0 debug1: identity file /Users/yzy/.ssh/id_rsa-cert type -1 ... debug1: identity added to agent: /Users/yzy/.ssh/id_rsa debug1: Authentication succeeded (publickey). Authenticated to github.com ([126.96.36.199]:22). debug1: channel 0: new [client-session] debug1: Entering interactive session. debug1: pledge: network debug1: Sending environment. debug1: Sending env LC_CTYPE = UTF-8 Hi ZhiyuanYaoJ! You‘ve successfully authenticated, but GitHub does not provide shell access. debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: channel 0: free: client-session, nchannels 1 Transferred: sent 3444, received 2300 bytes, in 0.2 seconds Bytes per second: sent 16119.7, received 10765.2 debug1: Exit status 1
Luckily I found a solution here :
git remote set-url origin [email protected]:your_git_id/your_repo_name.git