1

My problem is that I need to perform a clone and a commit from a server which using gitolite to create remote repository.

When I perform a manual clone with www-data user :

git clone ssh://git@git-repo.fr/client_1_foo /tmp/client_1_foo

The project is clone.

But when the same comand is called by my script(PHP) I get an error 128 (SSH error).

EDIT : (user executing the script is www-data) Any idea ?

gitolite conf :

repo client_1_foo
    RW+ = @client_1_foo_ADMIN @all www-data
    RW = @client_1_foo_DEV Jenkins
    R = daemon
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Laustralien
  • 95
  • 10
  • So, as `www-data`, I suppose `ssh -Tv git@git-repo.fr` does work? And what does `ssh -Tvvv git@git-repo.fr` when executed by the user executing your script? Ie. which user is running your PHP? – VonC Sep 12 '13 at 13:23
  • Is it possible your PHP script incorrectly set the url? As in http://stackoverflow.com/questions/6564309/git-ls-remote-returns-128-on-any-repo ? – VonC Sep 12 '13 at 13:43
  • Yes that's it ! ':' instead of '/' before repo name ! Merci ! – Laustralien Sep 12 '13 at 14:42
  • Excellent. I have added an answer to illustrate that point. – VonC Sep 12 '13 at 14:57

1 Answers1

0

As in "git ls-remote returns 128 on any repo", it is probable the script doesn't build the ssh url properly.

git://host:repo (correct)
# instead of 
git@host/repo (incorrect)

The SCP syntax for ssh url usually involve a ~/.ssh/config file which would resolve the string preceding the ':' into a server, user, port and ssh key (as in "Why can't git resolve the hostname when I push to a valid SSH address?").

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