如何解决Windows PowerShell中的“无法推送某些文件”错误?

问题描述:

我开始使用Git和我自己的Git服务。我创建了一个名为WhereIsMyPi的项目。如何解决Windows PowerShell中的“无法推送某些文件”错误?

这里发生的事情:

 
Windows PowerShell 
Copyright (C) 2016 Microsoft Corporation. Alle Rechte vorbehalten. 

Das Laden von persönlichen und Systemprofilen dauerte 1986 ms. 
~\Documents\GitHub [(unknown)]> cd C:\Users\Suriyaa\Downloads\WhereIsMyPi 
~\Downloads\WhereIsMyPi [master]> git push origin master 
Counting objects: 5, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (5/5), done. 
Writing objects: 100% (5/5), 1.43 KiB | 0 bytes/s, done. 
Total 5 (delta 0), reused 0 (delta 0) 
remote: Skipping command-line '"C:\Program Files\Git\mingw64\bin\..\usr\bin\bash.exe"' 
remote: ('C:\Program Files\Git\mingw64\bin\..\usr\bin\bash.exe' not found) 
remote: Need a valid command-line; Edit the string resources accordingly 
remote: error: hook declined to update refs/heads/master 
To https://git.suriyaa.tk/SuriyaaKudoIsc/WhereIsMyPi.git 
! [remote rejected] master -> master (hook declined) 
error: failed to push some refs to 'https://git.suriyaa.tk/SuriyaaKudoIsc/WhereIsMyPi.git' 
~\Downloads\WhereIsMyPi [master]> 

它正常工作,直到Git的报告,我没有bash命令。这是错误输出:

 
remote: Skipping command-line '"C:\Program Files\Git\mingw64\bin\..\usr\bin\bash.exe"' 
remote: ('C:\Program Files\Git\mingw64\bin\..\usr\bin\bash.exe' not found) 
remote: Need a valid command-line; Edit the string resources accordingly 
remote: error: hook declined to update refs/heads/master 
To https://git.suriyaa.tk/SuriyaaKudoIsc/WhereIsMyPi.git 
! [remote rejected] master -> master (hook declined) 
error: failed to push some refs to 'https://git.suriyaa.tk/SuriyaaKudoIsc/WhereIsMyPi.git' 

路径C:\Program Files\Git\mingw64\bin\..\usr\bin\bash.exe也不存在。我的实际bash命令在C:\Program Files\Git\mingw64\bin

我该怎么办?

+0

使[hook](https://git-scm.com/book/gr/v2/Customizing-Git-Git-Hooks)指向正确的路径? –

+0

不是。 Git工作正常,但Bash是当前的问题。我需要一个有效的命令行来相应地编辑钩子的字符串资源。 – Suriyaa

https://github.com/git-for-windows/git/issues/1204#issuecomment-321261122的解决方案!

问题是cygwin64中的bash命令。不是Git客户端或Git服务器!


我的步骤来解决这个问题:

  • 我重新安装Git和cygwin64
  • 在cygwin64
  • 安装bashgit依赖删除我的所有命令,并把这个内容:PATH=$PATH.bashrc(bash设置是主要问题)
  • 重新启动计算机
  • 启动一个新的Git仓库
  • 作了一次提交
  • 按承诺我的Git服务器
  • ✅固定。
  • Hooray!