Git提交挂在1kb文件提交

时间:2017-04-21 22:15:10

标签: git windows-8.1

环境:使用Git CMD的Win8.1

所以我一直试图在我的Windows机器上确定Git flakiness。我能够将远程仓库克隆到新的新目录中。 github repo内容是在我的Mac上创建的,如果这有任何区别的话。我将一个1kb的文本文件添加到Windows本地,名为Add_file.txt。我似乎能够添加文件但不提交文件没有git提交挂起。

如何追踪幕后发生的事情以找出我无法提交的原因?我尝试过这个程序时反复挂起。如果我此时杀死ctrl + c,则会留下一个git lock文件,这会阻止本地的任何进一步的git命令。删除git lock文件并不能解决git commit无法解决的问题。

有什么想法吗?

    C:\Users\mylocaluser\Documents\GitHub>git clone https://github.com/mygitaccount/99_Gitbug.git
    Cloning into '99_Gitbug'...
    remote: Counting objects: 11, done.
    remote: Compressing objects: 100% (7/7), done.
    remote: Total 11 (delta 1), reused 11 (delta 1), pack-reused 0
    Unpacking objects: 100% (11/11), done.

    C:\Users\mylocaluser\Documents\GitHub>cd 99_Gitbug
    C:\Users\mylocaluser\Documents\GitHub\99_Gitbug>git status
    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)

            Add_file.txt

    nothing added to commit but untracked files present (use "git add" to track)

    C:\Users\mylocaluser\Documents\GitHub\99_Gitbug>git add Add_file.txt

    C:\Users\mylocaluser\Documents\GitHub\99_Gitbug>git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)

            new file:   Add_file.txt


    C:\Users\mylocaluser\Documents\GitHub\99_Gitbug>git commit -m "6th commit to local WIN repo"

1 个答案:

答案 0 :(得分:0)

我确信这些都是新问题,但是对于那些试图学习git的穷人而言,在我的WIN8.1机器上遇到了我的解决方案。每个git命令的确切语法都包含在示例代码中。

1)如果在Windows计算机上克隆远程仓库失败,请尝试使用HTTP而不是HTTPS远程URL作为您的仓库。 HTTPS克隆彻底失败了。

    > git clone http://github.com/Agent-Sesame/99_Gitbug.git

2)如果你发现git commit挂了&amp;在你的Windows上失败,尝试使用'刻度而不是“引号”来包围你的提交状态消息。关于这个约定的棘手部分是“似乎在Mac OSX上使用git支持。”

    > git commit -m '6th commit from WIN'
祝你好运〜

相关问题