git 异常

2 篇文章 0 订阅
2 篇文章 0 订阅

1.首次安装时.如何切换git的默认目录?

 

 

打开桌面快捷方式,删除目标结尾 “--cd-to-home”.修改起始位置为需要修改的启动目录.

 

2.添加当前文件夹中所有文件到上传列表中报错.

$ git add .

warning: LF will be replaced by CRLF in .idea/compiler.xml.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in .idea/gradle.xml.

The file will have its original line endings in your working directory.

warning: LF will be replaced by CRLF in .idea/misc.xml.

..........

解决办法:

下面命令好像是设置全局代码自动换行 的状态为false

$ git config --global core.autocrlf false

 

3.最后一步上传出错

$ git push -u origin master

Username for 'https://git.oschina.net': mygit

To https://git.oschina.net/mygit/Jpush.git

 ! [rejected]        master -> master (fetch first)

error: failed to push some refs to 'https://git.oschina.net/mygit/Jpush.git'

hint: Updates were rejected because the remote contains work that you do

hint: not have locally. This is usually caused by another repository pushing

hint: to the same ref. You may want to first integrate the remote changes

hint: (e.g., 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

解决办法:

1重新添加远程仓库地址.


$ git remote add origin https://git.oschina.net/mygit/Jpushgit

fatal: remote origin already exists.


 A.1添加远程仓库地址出错

   解决办法: 删除远程仓库.


$ git remote rm origin

 

B.重新添加远程仓库地址.


$ git remote add origin https://git.oschina.net/mygit/Jpushgit

 

C.执行数据上传


$ git push -u origin master

Username for 'https://git.oschina.net': mygit

Counting objects: 117, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (87/87), done.

Writing objects: 100% (117/117), 17.14 MiB | 327.00 KiB/s, done.

Total 117 (delta 20), reused 0 (delta 0)

remote: Resolving deltas: 100% (20/20), done.

To https://git.oschina.net/mygit/Jpush.git

 * [new branch]      master -> master

Branch master set up to track remote branch master from origin by rebasing.

D.上传完成.

 

4.问题3还有一种解决办法:

 使用命令

$ git pull --rebase origin master 合并远程仓库文件到本地.然后再次进行上传.

5.上传文件时出错:

error: src refspec master does not match any..

错误信息上传为内容为空.git上传到远程仓库时需要先用<git add 上传的文件名.md> 将上传的文件添加到上传队列.

 

 

6.git操作错误及解决办法集合.

 参考博客:

 http://blog.csdn.net/dengjianqiang2011/article/details/9260435


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值