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

  • 相关阅读:
    Office Shared-Addin : Favorite的下载、安装和使用(2020.2.22)
    VBA编程常用词汇英汉对照表
    Excel-DNA自定义函数的参数智能提示功能:ExcelDna.IntelliSense1.1.0.rar
    VSTO开发中级教程 配套资源下载
    TreeviewEditor.rar
    FaceIDViewer.rar
    imageMso7345.rar
    VisualStudioAddin2016Setup.rar
    VBE2014_Setup_20160709.rar
    documen.write 和 innerHTML 的区别?
  • 原文地址:https://www.cnblogs.com/CVstyle/p/6188022.html
Copyright © 2011-2022 走看看