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 &&.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With