GitBash常见错误

1. $ git remote -v 后无反应

原因:远程仓库未创建(有可能是复制的远程仓库用的https地址,而原来远程仓库地址remote url设置的是ssh地址)

解决方案:创建远程仓库即可

$ git remote add orgin(远程仓库名) url(远程仓库地址ssh/https)   

注意 : ”url”不需要打上

2.

error:Unknown subcommand:origin

远程仓库origin不存在(需要先创建远程仓库)

3.

usage: git remote add [<options>] <name> <url>

创建远程仓库格式不正确

 

4..本地仓库push到远程仓库失败

error: failed to push some refs to 'https://github.com/Chouett/weatherstore.git'

 

原因: 
GitHub远程仓库中的README.md文件不在本地仓库中。 

解决方案:

(1)

$ git pull --rebase origin master

$ git push -u origin master

(2)

使用强制push的方法:$ git push -u origin master -f     多人协作不建议使用

 

 

 


版权声明:本文为qq_41850194原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。