zoukankan      html  css  js  c++  java
  • Git使用疑难问题分析

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

    目录:

    1. no new change问题;

    2. unpacker error问题;

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

    4. 中文乱码(git status);

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

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

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

    2. 仍然是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。

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

    具体现象如下:

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

    输入以下指令即可:

    $ alias ls='ls --show-control-chars --color=auto'
    

    4. 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
            "346226260345273272346226207346234254346226207346241243.txt"
    
    nothing added to commit but untracked files present (use "git add" to track)
    

    解决办法为,输入如下指令:

    git config --global core.quotepath false
    

    5. 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)。

  • 相关阅读:
    基于JavaFXWJFXGameEngine游戏引擎介绍与进度
    进程线程与cpu绑定
    [Vim练级攻略] Vim基础操作
    hdu 2159 fate
    python的httplib注意事项
    SQL优化总结
    项目整体开发流程以及配置人员
    hdu 1010 解题报告 Tempter of the Bone
    在centos搭建git服务器时,不小心把/home/git目录删除了,我是怎么恢复的
    int 和bigint差别有多大?
  • 原文地址:https://www.cnblogs.com/CVstyle/p/6188022.html
Copyright © 2011-2022 走看看