-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.txt
84 lines (63 loc) · 2.75 KB
/
README.txt
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Server:
Create configuration file for Apache and paste content of localhost-vhosts file inside to make it work with this Git structure
sudo su
a2enmod vhost_alias
nano /etc/apache2/conf.d/vhosts
service apache2 restart
Create the bare repository on the server:
mkdir -p /git/com/example.git
cd /git/com/example.git
git --bare init
Copy needed Git hooks in bare repo:
cp /path/to/post-* /git/com/example.git/hooks/
chmod +x /git/com/example.git/hooks/*
Client:
Clone that repository on the client:
mkdir -p /git/com
ln -s /git /web
cd /web/com/
git clone ssh://user@server/git/com/example.git
(Optional) Create the master branch
cd example/
Add or create new files in domain/www/
git add -A
git commit -m "Initial commit"
git push origin master
The website should now be available at www.example.com
Test website locally (for Ubuntu):
apt-get install bind9
cp /etc/bind/db.local /etc/bind/db.local.bak
echo -n "*.localhost. IN A " >> /etc/bind/db.local
ifconfig eth0 |grep "inet addr" |awk '{print $2}' |awk -F: '{print $2}' >> /etc/bind/db.local
service bind9 restart
echo "nameserver 127.0.0.1" >> /etc/resolv.conf
exit
Edit /etc/apache2/conf.d/virtual file to make it work with this Git structure
The website should now be available at www.example.com.localhost
Installing and using Git Flow:
Download the git-flow package for Precise Pangolin from the Ubuntu website
Install the package by double clicking on it
Now, in a git folder, initialiaze Git Flow with:
git flow init
Choose these names for branches:
1. develop
2. feature-
3. release-
4. hotfix-
5. support-
We cannot keep the default names (e.g. release) because it will be used as a subdomain, and subdomain names can't contain a forward slash. For the same reason, do not put an underscore in a branch name. Only characters a to z, 0 to 9 and hyphen.
To start a new feature branch:
git flow start test-branch
git push origin feature-test-branch
To merge back and delete a branch:
git flow finish test-branch
git push origin --delete feature-test-branch
For more commands, please check these examples on the git flow GitHub, and this blog post.
Inspiration/sources:
1. http://joemaller.com/990/a-web-focused-git-workflow/
2. http://superuser.com/questions/103516/apache-serve-files-from-git-repo-branches
3. http://httpd.apache.org/docs/2.2/vhosts/mass.html
4. http://nvie.com/posts/a-successful-git-branching-model/
5. http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/
Known issues:
1. Can’t go more than 2 subdomains deep but I don’t think that’s a big issue since we probably won’t have websites with a name composed of more than 2 subdomains. Example: test.lab.example.com will work, but not client.test.lab.example.com