Git_Error_fatal: git-pull cannot be used without a working tree

 

#Error

   fatal: /usr/local/libexec/git-core/git-pull cannot be used without a working tree. 

    注意,不是git版本问题,有些文章的解释是错误的。

 

#原因

  在bare仓库执行git pull操作

  bare库,本身只作为仓库使用,而不作为工作区使用,即is not a working tree。

 

#解决方法:

  - 不用解决。

 

参考:

http://stackoverflow.com/questions/8565828/troubleshooting-git-pull

A bare repository doesn't have a working tree. git pull is functionally the same as a git fetchfollowed by a git merge, and to do a merge you have to have a working tree (in case there are conflicts you need to sort out).

 

You have to push to a bare repo. Pull will not work as it requires a working directory to merge to, which is what the error message that you see says.

So setup a remote to the bare repo from the repo that you will be working on and push from that.

PS: The ideal way to create a bare repo is to do git init --bare <reponame>

 

#错误分析

  还是要加深对事物本质的理解。

 

0

1

2

3

=

*

%

#

你可能感兴趣的:(error)