使用git-clone命令从github上同步github上的代码库时,如果使用SSH链接,而你的SSH key没有添加到github帐号设置中,系统会报下面的错误:

Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

这时,需要在本地创建SSH key,然后将生成的SSH key文件内容添加到github帐号上去。创建ssh key的过程如下: 
输入命令:ssh-****** -t rsa -C "[email protected]"

然后根据提示连按三次enter键,生成的SSH key文件就保存到C:\Users\Administrator.ssh文件夹下的id_rsa.pub文件中。 
如图所示: 
使用git客户端第一次git clone github.com代码的方法

用文本工具打开id_rsa.pub文件,复制其内容。将其粘贴到github账号下的SSH key中。 
登陆自己的github账号,选择“setting”选项,添加SSH key.如图所示:

使用git客户端第一次git clone github.com代码的方法 
使用git客户端第一次git clone github.com代码的方法


然后就可以clone自己的github上的代码了。

git clone命令:git clone [email protected]:Jameszhjj/W3C.git

git add命令:git add -A

git commit命令:git commit -m " "

git push命令:git push (origin master)(括号内可选)


相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-05-07
  • 2021-11-20
  • 2021-09-11
  • 2021-07-24
猜你喜欢
  • 2021-07-17
  • 2022-12-23
  • 2021-11-20
  • 2021-05-09
  • 2021-11-20
  • 2021-07-05
  • 2022-12-23
相关资源
相似解决方案