githooks

python Force git hook server side output on same line in realtime

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-07 03:49:06
问题 git hooks server side output only transmits on a newline. I want to configure a custom task and print real-time output on the same line. How can I achieve that? I tried sys.stdout.flush but it transmits everything once complete. It does work in real-time if I add a newline. I want something like Step A)Started......Completed with each '.' appended after a given time. My current code looks like the following and it outputs only when the method is completed. import sys, time, os def print

Nothing happens on git pull hook (post-update)

我们两清 提交于 2020-01-06 11:17:07
问题 when I do a git pull on live server I'm logged in as root and so all modified or new files user and group are set to root:root . I've tried this set up in my post-update hook file: OWNER="example:example" REPO_PATH="/home/example/public_html" cd $REPO_PATH || exit unset GIT_DIR FILES="$(git diff-tree -r --name-only --no-commit-id)" git merge FETCH_HEAD for file in $FILES do chown $OWNER $file done exec git update-server-info When I run a git pull it just doesn't do anything. 回答1: Running git

Git pre-commit hook check message

走远了吗. 提交于 2020-01-05 01:40:48
问题 i have git commit hook script , whom checking commit input message, and if message not contain the word "updated" the script has reject commit. #!/bin/bash read -p "Enter a commit message: " message if [[ ${message} != *"updated"* ]];then echo "Your commit message must contain the word 'updated'" else git commit -m "$message" fi how to make this hook automatically executable if i try to push some files in my local repo with message: git commit -m "updated:something" , my idea is make it not

git post-receive hook in php

痞子三分冷 提交于 2020-01-04 05:20:26
问题 I want to be able to execute a php hook on post-receive hook, to copy files from the git repo to web folder on the same server and only run if it was pushed was made on a master branch ignoring other branches. Below is what I've got so far. !/usr/bin/php <?php exec("git archive master | tar -x -C /var/www/", $output); ?> Basically, im not sure how to access git arguments using php. 回答1: Don't forget a post-receive hook doesn't take arguments : it reads data on stdin. The "post-receive" script

Git post-receive hook. Move everything except a few folders

随声附和 提交于 2020-01-03 01:47:27
问题 I have implemented a post-receive hook on my server (git was initialized with git init --bare ). Hook was created in the following way: cd repo/hooks/ touch post-receive chmod 777 post-receive Then inside of the file I have: #!/bin/sh GIT_WORK_TREE=/var/www export GIT_WORK_TREE git checkout -f Right now when I push my local changes everything gets moved to /var/www folder. The problem is that I do not want some of the folders to be moved. For example I have folder1 , and folder2 there which I

Executing git-hooks on windows errors out

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-03 01:41:33
问题 So, I have written a simple git-hooks for pre-push which works just fine on Linux or Mac, but doesn't work on Windows. Script: Tries to match the commit message with a regular expression, and should return 0 if matches or else exit. Based on the articles I read, they say that the hook should just work. Command: if [[ "$message" =~ "$regular_expression" ]]; Error: .git/hooks/pre-push: line 6: conditional binary operator expected .git/hooks/pre-push: line 6: syntax error near `=~' .git/hooks

How to disable GIT hooks for security reason?

微笑、不失礼 提交于 2020-01-02 16:25:31
问题 If you clone a git repository, the hooks are not cloned for security reasons I suppose. But what if I get a repository by an other way like a ZIP file? How can I make sure there is no hook executed when I run GIT commands on a repository which I don't fully trust? What I can think of, is to remove the executable flag of all files in the .git/hook directory. But according to the documentation, the hooks are only normally stored in this directory so there might be other places to clean first.

How to disable GIT hooks for security reason?

旧巷老猫 提交于 2020-01-02 16:24:10
问题 If you clone a git repository, the hooks are not cloned for security reasons I suppose. But what if I get a repository by an other way like a ZIP file? How can I make sure there is no hook executed when I run GIT commands on a repository which I don't fully trust? What I can think of, is to remove the executable flag of all files in the .git/hook directory. But according to the documentation, the hooks are only normally stored in this directory so there might be other places to clean first.

modifying working directory and staging area temporarily in git pre-commit hook

时间秒杀一切 提交于 2020-01-02 08:10:29
问题 I'm using an an approach similar to this one to use a pre-commit hook to track changes to my database schema (as well as a few metadata-ish tables). I like to try to keep my commits clean so I want to be loudly warned in the commit message when there are automatic changes being staged/committed. Here are my pre-commit and pre-commit-msg hooks: .git/hooks/pre-commit #!/bin/sh # Save user changes to db/ (if any) git diff --quiet db/ user_dirty=$? [[ $user_dirty > 0 ]] && git stash save --keep

Aggregating and uglifying javascript in a git pre-commit hook

徘徊边缘 提交于 2020-01-02 07:38:56
问题 I'm using ready.js to aggregate JS files into an all.js file (without Google's Closure Compiler), and then using uglify-js to minify and obfuscate the code. I'd like to do all of this in a pre-commit hook. However, I think I'm doing something wrong. My .git/hooks/pre-commit file looks like this: #!/bin/sh readyjs ~/Sites/backbone/js/javascripts/ ~/Sites/backbone/js/ --nojslint -o "underscore.js, backbone.js" --nocompiler uglifyjs -nm -o ~/Sites/backbone/js/all.min.js ~/Sites/backbone/js/all