错误一:fatal: Not a git repository (or any of the parent directories): .git
此错误是因为你当前所在的文件夹还没有git成本地仓库,确保你是在作为本地仓库的文件夹下,然后使用:git init
错误二:
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
此错误是你还关联远程仓库时使用的地址不正确,如果你是关联你的远程仓库可以使用Https,但如果你关联的远程仓库只能使用ssh地址,那你要在远程仓库添加你的ssh密钥。如果你没有ssh key,那就先创建
1.创建SSH Key
在终端输入(输入完成后回车几下):ssh-keygen -t rsa -C "GitHub的邮箱地址"
2.切换到~/.ssh目录下
cd 路径(上面命令的输出的内容有完整的路径,我的是/home/lihongcheng/.ssh)
用ls命令可以查看此目录下的文件有id_rsa(私钥)和id_rsa.pub(公钥)
3.显示公钥
cat id_rsa.pub
然后把显示出的私钥粘贴放到一个文件(此步可以不做)
扫描二维码关注公众号,回复:
3905201 查看本文章