Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# Script to take a local git project and set up a remote project on our
# git server
# NB: This assumes your current working dir is the top-level of the project
# you want to send to the remote server, and that the local project is
# already a git repo.
THIS_PROJECT=`basename $cwd`
# Create the remote repo
ssh $GIT_SERVER "mkdir ${GIT_HOME}/${THIS_PROJECT}.git && cd git/${THIS_PROJECT}.git && git init --bare"
# Add the remote repo to this project
git remote add origin ssh://${GIT_SERVER}${GIT_HOME}/${THIS_PROJECT}.git
# Send the latest version to the remote server
git push origin master
# Track the remote master branch
cat >> .git/config << MASTER
[branch "master"]
remote = origin
merge = refs/heads/master
# Check we're up to date
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment