Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
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 '' vars as needed:
function gitup
projdir=`git rev-parse --show-toplevel`
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