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

  • 相关阅读:
    面试再问ThreadLocal,别说你不会
    利用 Docker Compose 搭建 SpringBoot 运行环境(超详细步骤和分析)
    高并发场景下缓存处理的一些思路!
    利用Dockerfile部署SpringBoot项目
    [RH254] 1-运行级别
    [RH134] 12-系统启动
    [安全] HTTPS的理解
    [工具] Wireshark与相关的网络安全
    [Python自学] 爬虫(5)selenium
    [Python自学] 爬虫(4)xpath
  • 原文地址:https://www.cnblogs.com/CVstyle/p/6188022.html
Copyright © 2011-2022 走看看