- Install git server (with git-http-backend)
/etc/httpd/conf.d/git.conf
SetEnv GIT_PROJECT_ROOT /usr/share/git/
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
<Location /git/>
AuthType Basic
AuthName "Git Access"
AuthUserFile /etc/httpd/conf.d/git-team.htpasswd
Require valid-user
</Location>
Create username/password (with htpasswd)
htpasswd -bc /etc/httpd/conf.d/git-team.htpasswd user pass
Create git repo (under /usr/share/git/)
git init –bare
Make sure the git folder is accessible by apache:
chown -R apache:apache /usr/share/git
If using Windows as client, maybe you need to config:
git config core.sharedRepository "all"
git config receive.denyNonFastForwards True
- auto sync code to remote
Clone a local repo on remote machine, and make it sync with master repo.
cd /usr/share/web
git clone /usr/share/git .
… add all your web files and git submit …
git push origin master
Create a web handler to pull changes from master:
Route::get(‘/pull’, function () {
return system(‘cd /usr/share/nginx/web && git pull’);
});
- Now I can enjoy writing code on my local machine, and push it to remote repo, then flush remote to take effect.
git push origin master
curl http://remote.machine/pull
The post Enabled remove development environment appeared first on Fei Zou's Blog.