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

今天刚看《第一行代码》的最后一章开发天气预报时:用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
出现:http://www.crifan.com/files/pic/uploads/2015/02/try-git-pull-rebase-origin-master_thumb.png
再输入: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

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值