git-receive-pack: command not found in Windows

后端 未结 4 1462
忘掉有多难
忘掉有多难 2021-01-12 08:24

Wondering how to fix this problem in Windows ?

When i try and use the command \"git push origin master\" I get

git-receive-pack: command not

相关标签:
4条回答
  • 2021-01-12 08:54

    You need to add the bin folder path where git was installed to the PATHS of the Windows System Environment variables. But if you have installed git using a 64-bit installer the path is different:

    C:\Program Files\Git\mingw64\bin
    

    notice the sub path "mingw64".

    0 讨论(0)
  • 2021-01-12 08:56

    I had a similar problem when trying to execute a git pull from another Win-7 machine. Here's what I did:

    • In order to interact with remote repositories via Git, the Git directories need to be added to the REMOTE machine's Windows PATH environmental variable (this should be done for any Windows machine running Git and needing to clone, push, or pull)
    • Git directories to add (so far):

      ..\git\bin, ..\git\libexec\git-core, ..\git\cmd

    • To modify the Windows-7 path, use the following:

      Click Start, then right-click on "Computer" and select "Properties", On the left panel, select "Advanced system settings", In the System Properties dialog, click on the "Environmental Variables…" button, Select "Path" from the "System variables list", and click the "Edit" button

    Add the needed paths to the end of the existing Path string using a semi-colon as the delimiter. Note: the path needs to be specified from the disk root (e.g. C:).

    0 讨论(0)
  • 2021-01-12 09:14

    I had this problem when I mistakenly tried to git clone a repo that was actually a Mercurial repo. Someone else created the project and I'd never used Mercurial before.

    Felt like an idiot, but I couldn't find any answers on SO that fixed it. Whoops!

    0 讨论(0)
  • 2021-01-12 09:15

    From Git FAQ:

    Basically the problem is that 'git-receive-pack' is not in the default $PATH on the remote end.

    You can see the problem using a DOS window:

    set PATH
    

    (display the path)

    type

    set PATH=%PATH%;"c:/program files/Git/Bin"
    git push origin master
    

    If that solves the problem, you will be better off adding that path in your user environment variables (see this superuser question for instance)


    Or a bash Git shell:

    $ export PATH=$PATH:"/c/Program Files/Git/bin"
    $ git push origin master
    

    Check also your .bashrc in your $HOME path ('echo $HOME' within a bash session; add the export line in it, or simply '~/.bashrc')


    Note: a classic msysgit installation should have taken care of those path.

    0 讨论(0)
提交回复
热议问题