9

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 found

Any idea how I can fix this in windows ?

The path to GIT is in c:/program files/Git/Bin/ but unsure how to set this ?

Thx

Edit: doing

git--exec-path
c:\Program Files\Git/libexec/git-core

Now how to setup this somewhere?

  • the solution was from a DOS windows. – VonC Sep 27 '09 at 15:18
  • Just added the command for a bash Git shell. – VonC Sep 27 '09 at 15:22
  • hey yeah i tried it from a DOS window ? still getting the git-receive-pack error ? thanks alot for your help –  Sep 27 '09 at 15:23
  • thanks for that - i am using msysgit so cygwin isn't installed ? –  Sep 27 '09 at 15:25
  • I fixed my answer: I do not mention "cygdrive" anymore ;) – VonC Sep 27 '09 at 15:30
  • thx so much - the GIT repo is in /d/GIT/GIT and the .bashrc is in /c/Users/Waj/.bashrc - totally new to GIT so not sure if this is correct? –  Sep 27 '09 at 15:43
  • the .bashrc seems to be in the right place. does its content export the right path? (the git repo can be anywhere you like) – VonC Sep 27 '09 at 15:48
  • hmm actually when i do ~/.bashrc - i get an "no such file or directory". i am using copSSH for Vista - so the /home/ directory where the .bashrc is stored is at C:\Program Files\ICW\home\Waj\.bashrc –  Sep 27 '09 at 15:51
  • and doing "echo $path" after your command now brings up "/c/Users/Waj/Bin/c/program files/git/bin" –  Sep 27 '09 at 15:58
  • Which is a problem: it should be `"/c/Users/Waj/Bin:/c/program files/git/bin`: the ':' should separate the two path. – VonC Sep 28 '09 at 03:50

5 Answers5

8

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".

Pengyy
  • 37,383
  • 15
  • 83
  • 73
johnsabre
  • 355
  • 2
  • 7
6

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • hey thx for the comment - i type that into the Git BASH and it comes up with sh.exe": c:/program files/Git/Bin: is a directory" then I still get the when I try git push ? –  Sep 27 '09 at 15:17
  • :) thanks a lot i am entering the bash GIT path - and when i try ssh localhost echo \$path - nothing appears after I do it ? i am stumped? –  Sep 27 '09 at 15:29
  • thanks for the solution. You're right, a classic installation should have taken care of this path-setting. I see your solution is from a decade ago but it still applies haha – Marvin Effing Jan 17 '19 at 10:29
  • @MarvinEffing A decade later, I still advocate for that approach instead of the classic installer: https://stackoverflow.com/a/54104048/6309 – VonC Jan 17 '19 at 10:58
5

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:).

DTS
  • 51
  • 1
  • 1
1

There are lots of answers around the web about paths. But in git version 2.38.1.windows.1, there is no such executable git-receive-pack anywhere.

Instead I found adding the following two lines in the repo's .git/config fixed it

[remote "<remote name>"]
    ... snip ...
    uploadpack = git upload-pack
    receivepack = git receive-pack
artbristol
  • 32,010
  • 5
  • 70
  • 103
-1

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!

Kyle Carlson
  • 7,967
  • 5
  • 35
  • 43