用git bash 传数据到远程出错:git push origin master 出错:error: failed to push some refs to

时间:2022-10-13 01:08:05

今天刚看《第一行代码》的最后一章开发天气预报时:用git bash与远程数据库传数据时,

遇到几个问题,虽然解决了,跟大家分享一下,

1,.输入 git add .

提示错误:fatal: Not a git repository (or any of the parent directories): .git

解决办法:

          (1)先输入:git init

                 这时输出:Initialized empty Git repository in f:/Program/MySecondDay/CoolWeather/.git/

          (2)再输入:git  add .

               就会输出:warning: LF will be replaced by CRLF in AndroidManifest.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in proguard-project.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in project.properties.
The file will have its original line endings in your working directory.

就可以了.

2.输入:git push origin master 

提示:fatal: 'origin' does not appear to be a git repository

以及fatal: Could not read from remote repository.
解决办法:

输入:git remote add origin git@github.com:djqiang/gitdemo.git

github:代表库名,就是你在google申请的,如我的:maiyu-green

gitdemo:代表项目名,如我的:CoolWeather


3,输入:

git push origin master

出错:error: failed to push some refs to

原因:本地没有update到最新版本的项目(git上有README.md文件没下载下来) 解决办法: 输入:git pull --rebase origin master 出现:用git bash 传数据到远程出错:git push origin master  出错:error: failed to push some refs to 再输入:git push origin master 就行了,(接着输入,名字和密码)Ok
附注:如果你的问题还没解决,请参考两篇大神的办法: http://www.crifan.com/git_github_git_push_origin_master_error_failed_to_push_some_refs_to/
http://blog.csdn.net/god_wot/article/details/10522405


33.3