Hi,
I'have encounter a problem with Git Hooks.
I have a bare repository that serve as central repository for all devs and I have one working tree repository that serve as source references. This last repository is updated automaticly by a post-receive hook that is define on the bare repository.
My problem is that for everyone else the push do trigger the hook properly but with Treesource I receive a "Error : file hooks/post-receive not found" when he try to reach for the hook script.
I have define remote properly and everything else work fine. But if I don't resolve this problem I'll have to change to another app for Gitting on Mac because I cannot have to update manually the repository each time a Mac dev needs to push to the bare repository.
Thanks for any help
SourceTree just calls 'git push', there is no reason I can think of that your server hook would behave any differently.
Please confirm:
OK so,
1- I'm on local network so it is a file directly, and also the push works fine, the problem comes after, Sourcetree (or Git I think) detect that there is a hook script to execute but can't reach the file.
2- Yea I did it myself on command line from a Mac and also from a Debian and it worked fine
3- I used "git push local:remote" as well and on Windows I'm using Gitextensions (similar to Sourcetree) and everything goes fine too.
4- For the path to the repository it seems fine, Sourcetree says that it cannot find the file in 'hooks/post-receive' and as the push occured well and the bare repository si up to date I deduce that Sourcetree is at the right place for activating the hook.
Thx anyway :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bear in mind that it's simply git that's trying to invoke the hook, not SourceTree. It's simply part of the 'git push' command.
I'm not surprised to hear that you're using a file URL; git can behave differently when pushing to local repositories rather than across http or ssh. If it's a SMB share, you should be very careful - git can sometimes corrupt repositories if you use it over SMB. Personally, over my LAN I only ever use SSH.
If the command line behaves differently, is this from the same machine? And how is the hook configured? What might be happening is that because the repo is local, the path to the hook may be ambiguous, particularly if it's relative - maybe it's getting confused between whether the hook should be in the source repo or the target repo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All right, I just try and it definetly comes from Git, the command line return the exact same message.
I'm gonna search around Git before bothering you again.
Thanks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeaa I thought of that too, I mean the part of the confusion between local/remote.
I'm gonna try a push from the same machine but with command line. Also what I didn't precise what that on all the station I use directory mounted as network drive, I think you already deduce that but just to clarify (I have a main directory that I mount that contain all my repositories in separate foler)
And the repository are indeed on a samba share because the server is on Win2008Server.
The hool configuration is simply the file without the .sample at the end end it contains those lines:
[code]
#!/bin/sh
cd ../../Sources/Working_Repository
echo 'Updating source repository in /Git/Sources/Working_Repository'
git --git-dir=.git --work-tree=. pull -v --progress "Base_Working_Repository" +refs/heads/*:refs/remotes/Base_Working_Repository/*
[/code]
*Working_Repository = name of the project that I have to hide :) but I checked the name are correct in all the station and in Sourcetree as well
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK that's good to know. I would definitely advise you to move away from using Samba with Git, I've seen people have problems with that before, including corruptions caused by a lack of guaranteed locking of files over SMB.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wish I could :p but it's not up to me thx anyway for the help.
I will update this feed if I found a solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All right so I identified the problem,
It comes from the remote definition in my central bare repository which is made with a SMB path that is common to all the win developper. But now that I have to make git works with Unix based system the samba path is taken as a wrong path logical for a Unix system.
The solution I put in place was to create two remotes on the bare repository, one with smb path and the other with Unix path, wich solve the problem of the access to the script, but I have now to check in my post-receive script what remote has been used so that I adapt the path to the source repository.
By any chance do you know how to detect what remote has been used to access to the repository in a hook script ?
Thx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All right so I have another hypothesis
It could comes from the fact that in the sources repository that are supposed to be udpated automaticaly the remote repository is set via a smb path so when the hook is called it tries to pull from a smb path instead of a unix path.
So I need to detect in the hook script what type of path is the right one, Unix or Smb b.
By any chance do you know how to detect the filesystem in a hook script?
Thx
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.