zoukankan      html  css  js  c++  java
  • Git

    1.windows使用git时出现:warning: LF will be replaced by CRLF

    分析: windows中的换行符为 CRLF, 而在linux下的换行符为LF,所以在执行add . 时出现提示

     解决: 

    1 $ rm -rf .git  // 删除.git
    2 
    3 $ git config --global core.autocrlf false  //禁用自动转换 

    2. 

    分析: 这是因为没有添加到Git中造成的删除失败, 不在Git的控制之下

    解决:

    $ git add 1.php
    
    $ git rm -f 1.php

    3. 拉取项目需要输入用户名,密码

      我们在git clone工程时有2中形式 https 和git@git。当你使用前者拉取工程时每次都需要输入用户名和密码

    解决:

    git config --global credential.helper store
    
    这个时候~/.gitconfig文件中会多一行
    
    [credential]
    helper = store

    4. 文件名称大小写无法进行修改(名称修改了之后,无法进行提交)

      原因: git默认配置为忽略大小写

      解决: 

        1) 全局设置

                        

    git config core.ignorecase false  //关闭git忽略大小写配置

         2)项目修改

      

    1. git rm xx 删除本地仓库文件(备份文件)
    2. 修改文件名称
    3. git add xx 添加
    4. git commit -m ''
    5. git push

     5. git push -u origin master    remote: User permission denied

      fatal: unable to access 'http://git.com:11024/lanlang/xs.git/': The requested URL returned error: 403

     解决: 设置用户信息并赋予权限

    git remote set-url origin https://youruser:password@github.com/user/repo.git
    
    说明: 添加到远程代码库的时候,需要指定用户名,密码
        最后执行 git push -u origin master 

     6. fatal: unable to access 'http://abc@qq.com:abc123456@git.xxx.com/www.git/':

     Couldn't resolve host 'qq.com:abc123456@git.xxx.com'

     报错原因是因为用户名包含了@符号,所以需求要把@转码一下

    <?php
    $userame='abc@qq.com';
    echo urlencode($userame);
    ?>
    abc%40qq.com

    @符号转码后变成了%40,所以只需在clone时将username变为abc%40qq.com即可,再次执行就ok了。

    为了防止密码中也可能会有@,我觉得在拼接之前,可以对用户名和密码分别进行编码操作。

     

     7. Please move or remove them before you can merge

    # 删除变化
    git clean -d -f

     8. 记Git报错-refusing to merge unrelated histories

    使用命令:

    $git pull origin master --allow-unrelated-histories

      

  • 相关阅读:
    社区运营一点事
    从拉动APP下载谈运营
    c#基础学习(0702)之面向对象和方法重写概述
    c#基础学习(0706)之使用虚方法实现多态
    c#基础学习(0703)之string.Format格式化日期
    c#基础学习(0701)之一些简单的方法练习
    c#基础学习(0630)之面向对象总习
    c#基础学习(0629)之导出Excel方法
    c#基础学习(0628)之使用进程打开指定的文件、模拟磁盘打开文件
    c#基础学习(0627)之类型转换、算数运算符++、--
  • 原文地址:https://www.cnblogs.com/xingxia/p/git_errors.html
Copyright © 2011-2022 走看看