账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    git clone 下来的文件乱码解决
    80
    0

    git clone 下来的文件乱码

    ➜  neg git:(master) ✗ head neg.0.txt
    ��׼��̫�� ���仹����3�ǵ� ������ʩ�dz��¾�.����Ƶ���ϵı�׼����¸���.
    
    
    ➜  neg git:(master) ✗ file neg.0.txt
    neg.0.txt: ISO-8859 text, with CRLF, CR line terminators
    # 尝试转化未果
    ➜  neg git:(master) ✗ iconv -f ISO-8859-1 -t UTF-8 neg.0.txt
    ±ê×¼¼äÌ«²î ·¿¼ä»¹²»Èç3ÐÇµÄ ¶øÇÒÉèÊ©·Ç³£³Â¾É.½¨Ò龯µê°ÑÀϵıê×¼¼ä´ÓиÄÉÆ.

    注:本地是Mac系统 有解决办法吗?

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 暗夜小仓鼠 普通会员 1楼

      如果你在克隆文件后发现文件的编码不正确,可以尝试以下几种方法来解决:

      1. 使用编码适配器:在Git中,你可以使用编码适配器来指定编码。例如,如果你的文件是UTF-8编码的,你可以使用以下命令来克隆文件:

      git clone https://github.com/yourusername/yourrepo.git

      如果你不确定如何使用编码适配器,可以在克隆文件之前先设置编码,然后在克隆完成后使用默认的编码。

      1. 使用默认编码:如果你的文件是默认编码的,那么在克隆文件之前应该先指定默认编码。例如,如果你的文件是UTF-8编码的,你可以使用以下命令来克隆文件:

      git clone https://github.com/yourusername/yourrepo.git git config --global encoding "utf-8"

      这将使Git自动使用UTF-8编码来解析文件。

      1. 使用--config选项:如果你的文件使用了特殊的字符编码,你可以使用--config选项来指定默认编码。例如,如果你的文件使用了GBK编码,你可以使用以下命令来克隆文件:

      git clone https://github.com/yourusername/yourrepo.git git config --global --edit "user.name" git config --global --edit "user.email" git config --global --edit "user.password" git config --global --edit "core.autocrlf" --add --set git config --global --edit "core.autocrlf" --set --remove --replace git config --global --edit "core.autocrlf" --add --set git config --global --edit "core.autocrlf" --set --remove --replace git config --global --edit "core.autocrlf" --add --set git config --global --edit "core.autocrlf" --set --remove --replace git config --global --edit "core.autocrlf" --add --set git config --global --edit "core.autocrlf" --set --remove --replace

      这将使Git自动使用GBK编码来解析文件。

      1. 使用--no-prompt选项:如果你不想在克隆文件之前提示用户输入编码,你可以使用--no-prompt选项。例如,你可以使用以下命令来克隆文件:

      git clone https://github.com/yourusername/yourrepo.git git clone --no-prompt https://github.com/yourusername/yourrepo.git

      这将使Git在克隆文件之前自动选择默认编码。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部