V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
zszdevelop
V2EX  ›  git

无法 git add 。 添加进暂存区???

  •  
  •   zszdevelop · 2015-05-14 12:34:02 +08:00 · 5081 次点击
    这是一个创建于 3271 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我在用hexo 配置github仓库的时候:

    使用git add .添加到暂存区去的时候总是出现

    warning: LF will be replaced by CRLF in 2015/05/14/hello-world/index.html.
    The file will have its original line endings in your working directory.

    请问要怎么解决?

    这时候好像commit不进记录记录。然后就发布不了。

    我尝试了google没有找到我想要的答案,求指教

    新手勿喷啊

    9 条回复    2015-05-14 13:48:25 +08:00
    Septembers
        1
    Septembers  
       2015-05-14 12:43:35 +08:00   ❤️ 1
    git push
    zszdevelop
        2
    zszdevelop  
    OP
       2015-05-14 12:56:03 +08:00
    我git push上去的时候就会没有共同之处。我觉得就是add 。那没有传上去吧。


    No refs in common and none specified; doing nothing.
    Perhaps you should specify a branch such as 'master'.
    error: failed to push some refs to '[email protected]:zszdevelop/zszdevelop.github.
    io.git'

    应该要倒回去解决
    The file will have its original line endings in your working directory.
    comicfans44
        3
    comicfans44  
       2015-05-14 13:07:12 +08:00   ❤️ 1
    LF CRLF这个问题应该是换行符引起的,大意是:
    虽然文件的换行符号变了,但是除此之外文件内容没有任何变化,所以没有任何提交。

    可以参考下http://git-scm.com/book/zh/v1/自定义-Git-配置-Git里面crlf的部分,看看如何处理符合你的要求
    Tiande
        4
    Tiande  
       2015-05-14 13:18:08 +08:00   ❤️ 1
    ```
    hexo clean #先清public文件夹
    hexo d -g #重新部署(并生成)
    ```
    yangtukun1412
        5
    yangtukun1412  
       2015-05-14 13:24:25 +08:00   ❤️ 1
    这个warning只是提示你在windows下换行符会被统一换成 CRLF 吧,不影响提交才对。

    git add 后要 先 commit 才能 push 的。
    zszdevelop
        6
    zszdevelop  
    OP
       2015-05-14 13:31:40 +08:00
    谢谢大家的回答,很有帮助。
    forcecharlie
        7
    forcecharlie  
       2015-05-14 13:35:32 +08:00
    设置一下 git config --global core.autocrlf false
    Tiande
        8
    Tiande  
       2015-05-14 13:45:23 +08:00
    github 仓库的设置是在 config 文件里面,
    直接用 hexo 的命令就可以完成部署,
    为什么还要手动 git add/commit?
    zszdevelop
        9
    zszdevelop  
    OP
       2015-05-14 13:48:25 +08:00
    我解决了。
    可能是因为我github上面没有创建好。导致的。

    第二次建立repositories的时候我选了README.md

    我pull下来、在push上去就好了。
    V2EX技术氛围真的很浓厚,好好学习
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2537 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 15:57 · PVG 23:57 · LAX 08:57 · JFK 11:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.