Skip to content

Instantly share code, notes, and snippets.

@gfixler
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfixler/c28e1743b758242fe434 to your computer and use it in GitHub Desktop.
Save gfixler/c28e1743b758242fe434 to your computer and use it in GitHub Desktop.
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