Last active
August 29, 2015 14:21
-
-
Save gfixler/c28e1743b758242fe434 to your computer and use it in GitHub Desktop.
Easy, initial uploading of git repos to a default location
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
# 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