1

I have a git repository on a server with an old version of git (1.7.1). I need a feature only available starting in git 2.3, namely I want to run the command:

git config receive.denyCurrentBranch updateInstead

After talking with the sysadmin, they installed a recent version of git (2.27.0) in a different location on the server. Using this newer version, I was able to run the above command for the repository.

However, whenever I push from my local machine to the server, I get the following error message:

fatal: bad config value for 'receive.denycurrentbranch' in ./config
fatal: Could not read from remote repository.

This seems to suggest that when I push to the server, the server defaults to running the old version of git. Is there a way to tell the server to run git from a different exec-path? When running

git --exec-path=/path/to/new/git/env

I am met with strange errors like git ignoring everything after the exec-path, or ignoring all the flags altogether. I am not sure if the --exec-path flag is even the right approach to this problem.

Phro
  • 375
  • 2
  • 11
  • 1
    This question has been answered [here](https://stackoverflow.com/questions/56990207/fatal-bad-config-value-for-receive-denycurrentbranch-in-config). – Assaf Bar-Natan Jun 02 '20 at 17:49

1 Answers1

1

You need to specify the new git-upload-pack/git-receive-pack

cd /path/to/local/repo
git config remote.origin.uploadpack /path/to/new/git/usr/bin/git-upload-pack
git config remote.origin.receivepack /path/to/new/git/usr/bin2/git-receive-pack

That would be a good start for making sure git push/pull talk to the right Git.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250