Membuat git Repository Untuk Website

From OnnoWiki
Jump to navigation Jump to search

Di komputer kita

$ mkdir website && cd website
$ git init
Initialized empty Git repository in /home/ams/website/.git/
$ echo 'Hello, world!' > index.html
$ git add index.html
$ git commit -q -m "The humble beginnings of my web site."

Di server

$ mkdir website.git && cd website.git
$ git init --bare
Initialized empty Git repository in /home/ams/website.git/
 
$ mkdir /var/www/www.example.org
$ cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/www.example.org git checkout -f
$ chmod +x hooks/post-receive

Balik lagi ke komputer lokal.

$ git remote add web ssh://server.example.org/home/ams/website.git
$ git push web +master:refs/heads/master

Test ngepush

$ git push web

referensi