# Tag Info

## Hot answers tagged hook

20

While the hook is running, GIT_DIR and (if the worktree was defined explicitly) GIT_WORK_TREE are set. That means your pull won't run with the second repository in the directory you changed to. Try git --git-dir ~/websites/testing/.git --work-tree ~/websites/testing pull; or unset git's repo-local environment with this: unset $(git rev-parse ... 6 incron, based on inotify, implements just such a hook in a cron-like way. Unfortunately, it is Linux-specific, not generic to UNIX. 6 See :he :autocmd and :he BufWritePost The line would look like this: :autocmd BufWritePost /path/to/file/or/pattern !command <afile> If the <afile> thing does not work use %:p. 5 gitlab already uses the post-receive hook internally. you could fiddle around with that script and call your hook as well, but from the docs it looks like the "official" way would be to use "web-hooks", i.e. let gitlab call your webserver on post-receive and your webserver then pulls the repository. I haven't tried this myself, but since no one answered so ... 4 I'm wondering if there's a better way of identifying which of the DIRS I should use and only update that one. svnlook dirs-changed is what you're looking for: # svnlook dirs-changed -r 40270 /path/to/the/repo project1/foo/bar Try something like this: #!/usr/local/bash4/bin/bash typeset -A IP typeset -A DOCROOT PROJECTS="project1 project2" ... 4 You might find incron of interest if you're using Linux. 4 As requested, a bit of a tutorial on groups. Hopefully this isn't too elementary. By default, most user accounts are also part of a group of the same name. To determine what groups an account is a member of, use the groups command. # groups root root : root bin daemon sys adm disk wheel The first one listed is the primary group, and will be the default ... 3 If you want to grant a user (such as git in your examples) access to another user's space, put them in the same group and set group rights accordingly. If you need more complex access control list functionality, you should look into POSIX ACLs as provided by getfacl(1) and setfacl(1). 3 The usual way to do something like that is CVS keyword expansion: http://cvsbook.red-bean.com/cvsbook.html#Using%20Keyword%20Expansion A small drawback is, that you'll have the$ signs in the file, but many people are used to this convention.

3

Gitlab doesn't have a post-receive hook since the developers replaced gitolite with gitlab-shell. Therefore you can: sudo -u git bash touch /home/git/repositories/<repository name>.git/hooks/post-receive vim /home/git/repositories/<repository name>.git/hooks/post-receive Make sure the git user has all the permissions needed to run the ...

2

I have had problems with case sensitivity and subversion on windows before. Could that be the problem? I would try this: echo "%VISUALSVN_SERVER%\bin\VisualSVNServerHooks.exe" ^ commit-notification "%1" -r %2 ^ --from <from-email> --to <to-email> ^ --smtp-server <smtp-server> > <somepath>\text.txt Check that the command echoed ...

2

If you are writing to a file, you could just write to "|yourimportscript" and have it run off the piped input. When apache is restarted, it would restart the process. It would spend the majority of its time waiting until it received input and wouldn't require a cron job. You could write your script as a daemon and use famd to see if the file was modified. ...

2

Short Answer: You can't get there from here. Longer Answer: There is no hook for "on account creation". You would have to wrap your user-creation into a script/process that also executes this python script after the account creation. Or, You can change your user-account-creation so that it is done from within a python script (or add those steps to your ...

2

I don't believe there are any accessible hooks for new user creation in AD. You could do a script to poll for users, keep track of the existing ones, and then provision any new users. I think that's about as good as you're going to get. The other option is to provision your AD users with Python from your intranet side. Creating AD users is fairly easily ...

2

This is the default behavior of SVN when working with a certificate it does not trust. Take a look at the SSL Certificate Management section in "Version Control with Subversion". If the client receives a server certificate, it needs to verify that it trusts the certificate: is the server really who it claims to be? The OpenSSL library does this ...

2

I think the problem lies in the fact that you've set up a command in the authorized_keys file, but man sshd's section on the authorized_keys file format clearly states: command="command" Specifies that the command is executed whenever this key is used for authentication. The command supplied by the user (if any) is ignored. (…) This means that ...

2

Do I need to restart Apache No. SVN-hooks aren't Apache side of game, it's pure Subversion toys, thus - create and use immediately on svn-events

2

Use svn update instead of svn checkout Make sure that you have Apache setup to ignore svn files

2

Thanks everyone for your answers. I managed to get it working in the end with the help of this post by doing the following: 1. Using Separate Script Add this line to sudoers file (using visudo). gituser ALL=(web-user) NOPASSWD: /usr/local/sbin/startnode Contents of file /usr/local/sbin/startnode changed to following: #!/bin/bash cd ...

2

You can use hooks to accomplish this. It has been discussed on stackoverflow. http://stackoverflow.com/questions/7147699/limiting-file-size-in-git-repository

2

Yup that is intended behavior. Your bounce doesn't pass check_recipient_access because smtpd directive and from your log, the bounce email never touch smtpd at all (bounce -> qmgr -> lmtp) One possible solution of your problem is using transport_maps instead of check_recipient_access. This directive was invoked by trivial-rewrite process and all email ...

1

I was able to accomplish this with ProFTPd & the mod_exec module.

1

I'd use incron. This uses the kernel's inotify hooks to run arbitrary commands on specified filesystem events.

1

Here's the script I ended up using, based on quanta's help: REPO="$1" REV="$2" declare -A PROJECTS PROJECTS=(\ [project1]="/path/to/projects/project1 /path/to/projects/project1-devel" \ [project2]="/path/to/projects/project2 /path/to/projects/project2-devel" \ [project3]="/path/to/projects/project3 /path/to/projects/project3-devel" \ ) ...

1

I believe it should happen immediately. No apache restart required.

1

There are benefits to the implementation you've done. Although you have omitted some possible edge-cases like checking for un-staged changes in other branches (you might want to add/stash first). The alternative to this is using a continuous integration system like Jenkins to handle the updates: https://wiki.jenkins-ci.org/display/JENKINS/Meet+Jenkins ...

1

Each argument to the post-update is the name of a ref which was updated by the push, and a branch is a ref whose name looks like refs/heads/<branch> so a script to do what you want would look something like this: #!/bin/sh for ref in "$@" do case "$ref" in refs/heads/*) /path/to/rebuild-site basename \$ref;; esac done

1

If you run Solaris 10 or newer, an OpenSolaris based distribution, FreeBSD, (a recent) NetBSD or MacOS X, a dtrace script will easily do that job.

1

I got the "getting back to vim" part, but I'm not sure how to hit the ":w" command itself (which would be very handy, since that's quite reflexive for me) w | silent execute "! myscript" | redraw! I think it may be better for superuser as well.

Only top voted, non community-wiki answers of a minimum length are eligible