digitalronin (owner)

Revisions

gist: 225970 Download_button fork
public
Public Clone URL: git://gist.github.com/225970.git
Embed All Files: show embed
Setup remote git project #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
 
# 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.
 
GIT_SERVER=yourgitserver
GIT_HOME=/home/remoteuser/git
 
cwd=`pwd`
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
MASTER
 
# Check we're up to date
git push