GitHub学习中的一些错误及解决方法

今天根据廖雪峰老师的教程

https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

学习了一些GitHub的知识,先将学习过程中的一些问题及解决进行分享

1、fatal: Not a git repository (or any of the parent directories): .git

 在执行: 

git add readme.txt

  时提示出错, 问题提示的是没有.git文件夹,解决方法为: 

git init

这句代码用于在当前Git Bash 所指的目录下新建一个.git文件夹

2、fatal: pathspec 'readme.txt' did not match any files

 在执行:

git add readme.txt

时提示该错误,问题是在问题1的生成的 .git文件夹的所在的文件夹目录中没有找到readme.txt。

此时查看自己是否有该txt文件。若有,但是目录不对,修改到你readme.txt所在的目录;若没有,则自己在.git文件夹所在的文件夹目录中,新建一个readme.txt。

扫描二维码关注公众号,回复: 1997432 查看本文章

举个例子

我在出现问题2的时候 Git Bash指的目录是 c/User/asus  但是我的readme.txt文件的目录为c/User/asus/learngit,因此提示找不到readme.txt 

3、fatal: remote origin already exists.

在执行 

git remote add origin https://github.com/tianchenweikai/learngit.git
之后,又尝试执行
git remote add origin [email protected]:tianchenweikai/learngit.git

遇到该问题

问题为  远程仓库已添加

解决方法为输入

git remote rm origin

删除前一条语句,然后再出入新的语句

仍有错误请参考:http://blog.csdn.net/top_code/article/details/50381432

4、The authenticity of host 'github.com ' can't be established

执行完问题3语句之后,再执行

git push -u origin maste

提交代码到github时,报错:

The authenticity of host 'github.com (192.30.253.112)' can't be established.RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.Permission denied (publickey).fatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.

该问题详见廖雪峰教程

https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013752340242354807e192f02a44359908df8a5643103a000

 SSH警告


猜你喜欢

转载自blog.csdn.net/qq_41718455/article/details/80861999
今日推荐