不去做怎么知道做不到,用心做好每一天做好每一|

轻风细雨_林木木

园龄:6年3个月粉丝:4关注:1

Git 使用报错集

Git 使用报错集

Git在实际的使用过程中会遇到很多实际问题,下面对这些问题做一一分析和解决。

目录:

  1. no new change问题;

  2. unpacker error问题;

  3. 中文乱码(ls -all);

  4. 中文乱码(git status);

  5. 推送代码是出现以下问题:

! [remote rejected] master -> refs/for/master (no new changes)

问题分析:Git bash提示:no new changes表示没有新的提交。Gerrit根据commit id和changeId判断是否有新的提交,如果以上两者都是相同的,则Gerrit会拒绝提交。解决办法:git commit --amend生成新changeId。

  1. 仍然是push代码时出现的问题
! [remote rejected] HEAD -> refs/for/k26s/ld/a107c (n/a (unpacker error))

解决方案:

$ git push --no-thin origin HEAD:refs/for/k26s/ld/a107c

在push指令中,添加参数: --no-thin。

  1. Windows平台下使用Git Bash显示中文出现乱码。

具体现象如下:

Administrator@ZHANGFENG /f/sptSrcGit/CarDoc (master)
$ ls
old_document ??????????????????

输入以下指令即可:

$ alias ls='ls --show-control-chars --color=auto'
  1. Windows平台下使用Git Bash时,执行 git status 时显示中文乱码问题:
yaya@yaya-PC MINGW64 /d/GitWorkspace/AndroidDemos/HandlerDemo (master)
$ git st
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
"\346\226\260\345\273\272\346\226\207\346\234\254\346\226\207\346\241\243.txt"
nothing added to commit but untracked files present (use "git add" to track)
</file>

解决办法:

git config --global core.quotepath false
  1. Windows平台下,提交代码出现以下提示内容:
yaya@yaya-PC MINGW64 /d/GitWorkspace/OpenSourceProjects (master)
$ git add .
warning: LF will be replaced by CRLF in AndroidIoT/gradlew.
The file will have its original line endings in your working directory.

究其原因:Windows平台下使用回车和换行符(CRLF)作为结束标志,Linux/Mac以换行符作为结束标志(LF)。

声明:本内容借鉴于http://www.cnblogs.com/CVstyle/p/6188022.html 详细请查看原文章

本文作者:轻风细雨_林木木

本文链接:https://www.cnblogs.com/linzhifen5/p/16961495.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   轻风细雨_林木木  阅读(31)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起
  1. 1 尚好的青春 孙燕姿
  2. 2 孙燕姿
  3. 3 克卜勒 孙燕姿
- 孙燕姿
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.