Git返回“'pull'不是git命令。在Windows 10上从远程查看'git --help'”

我在运行Windows 10的服务器上有一个bo黑猩猩服务器。 我正在尝试链接“更新”上的新钩子,以便可以直接从git更新来自节点开发服务器的文件。

我尝试使用cmd文件来执行此操作,示例如下:

更新钩子中的文件

cmd //C "start C:\webServer\node\testServer\update.bat"

testServer上同一文件夹上的update.bat

set PATH=%PATH%;C:\Program Files\Git\cmd\git.exe
cd C://webServer/node/testServer
git pull

那是返回以下错误:

git:'pull'不是git命令。参见'git --help'

I did some research and found out this post "git pull" broken where they talk about using -exec-path on Mac, I tried to search the equivalent in Windows and found out some variables for path related issues, tried them an none of them worked, also tried to reinstall git without any other result, at that point I was tired of it and I tried to use a node library, simple-git, that allows me to do a pull request using node specifying the path! I tried it on the server, and it worked! (I will attach the code of the file below) so I thought to try it from the remote server, but then I got the same error again, pull is not a git command, I tried to call the node file in different ways, I tried some python script to run a cmd command that runs the node server, I tried using bat and sh files, even using node to run another instance of node, and nothing worked, it always returns pull is not a git command :/

节点简单代码

require('simple-git')("C:\\webServer\\node\\testServer")
     .pull(function(a,b){
        console.log(a,b); //for debug
     })

还有其他信息,git已正确设置为环境变量,我可以从服务器访问它而不会出现问题,只有在尝试执行从钩子中拉出时,才会发生此问题!

如果有人可以给我一些尝试的技巧,那就太好了,谢谢!

评论