質問

I want to run a simple bash script after a git clone was made, that checks the url of the repository origin and applies specific git-author settings.

this configuration shall be done on the local environment (not in the repository).

is there a configuration setting that I can apply to call a bash script after a git clone has completed?

役に立ちましたか?

解決

Let us say the bash script you intend to run is in a file by the name shellscript.sh and it is on your path:

You can add the following bash function to your ~/.bashrc.

git() { 
   if [[ $1 == "clone" ]]; then 
      command git "$@" && shellscript.sh; 
   else 
      command git "$@"; 
   fi; 
}

Note: You can add any command after &&.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top