Created
December 2, 2020 16:07
-
-
Save codersgyan/f643ba84828a70983b1c6f1f03217869 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mkdir -p /var/repo/$1 | |
cd /var/repo/$1 | |
git init --bare | |
cd hooks | |
hookCommand="#!/bin/sh\ngit --work-tree=$2 --git-dir=/var/repo/$1 checkout -f" | |
echo $hookCommand >> post-receive | |
echo "Post-receive created at /var/repo/$1/hooks" | |
chmod +x post-receive | |
chmod -R 777 /var/repo | |
echo "Permission granted to repo" | |
echo "Setup completed succesfully 😅" | |
echo "You may now push to following url\n" | |
myIp=$(curl -s ifconfig.me) | |
echo "git remote add origin ssh://$USER@$myIp/var/repo/$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment