Created
February 18, 2020 14:51
-
-
Save h4de5/bc34af1c822c9dbe6cf10a73c919cff8 to your computer and use it in GitHub Desktop.
Create a bare git repository which allows pushing from other users of the same user group.
This file contains 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/bash | |
# usage ./create_bare_git.sh ProjectName | |
git init --bare --shared=group "$1.git" | |
LAST_USERGROUP=`groups | awk '{ print $NF }'` | |
# CURRENT_DIR=`pwd` | |
CURRENT_DIR=`realpath .` | |
chgrp -R $LAST_USERGROUP "$1.git" | |
echo "use this to set remote the first time:" | |
echo | |
echo "git remote add origin `hostname -f`:$CURRENT_DIR/$1.git" | |
echo "git push --set-upstream origin master" | |
echo "use this to change the remote of an existing project:" | |
echo | |
echo "git remote set-url origin `hostname -f`:$CURRENT_DIR/$1.git" | |
echo "git push --set-upstream origin master" | |
echo "use this to checkout the new repository:" | |
echo | |
echo "git clone `hostname -f`:$CURRENT_DIR/$1.git" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment