Easy, initial uploading of git repos to a default location
# The gitup function lets you type `gitup` from anywhere | |
# in a repo to upload it to your server. It also sets it | |
# up as an origin remote in the local repo. This is meant | |
# to be used in a new repo that has no server version yet. | |
# Note: I have the gitup function in my ~/.bashrc file. | |
# Modify these two 'example.com' vars as needed: | |
gitup_scp='example.com:git' | |
gitup_root='ssh://example.com/~/git/' | |
function gitup | |
{ | |
projdir=`git rev-parse --show-toplevel` | |
cd | |
git clone --bare $projdir | |
baredir=$(basename $projdir) | |
scp -r $baredir'.git' $gitup_scp | |
rm -rf $baredir'.git' | |
cd - | |
git remote add origin $gitup_root$baredir'.git' -f | |
git fetch | |
git push --set-upstream origin master | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment