Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
933 views
in Technique[技术] by (71.8m points)

git push - Using git to publish to a website

I used this guide to use git to autopublish my changes on my website when I push to my remote origin git repository:

http://www.lwp.ca/james/2010/03/using-git-to-manage-online-website-projects/

Here's my /hooks/post-update file:

cd ../../public_html/dir/wbg
env -i git pull

Here's my directory structure:

/home/git/wbg.git <-- my remote git repository

/home/public_html/dir/wbg <-- my web folder

When I run

git push origin master

The repository updates but my web folder is still empty. Any ideas?

Edit: if any future traffic sees this, my real problem was that BOTH your remote origin AND your destination website directory must be git repositories. You can't just set it up to copy your project to a new folder unless that folder is also a git repo.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can find a better alternative at http://toroid.org/ams/git-website-howto that only uses one git repository, and allows all metadata and previous history to remain outside of the DocumentRoot.

The guide you used and the one I linked referrer to another article both are based on, but the one I linked seems to be the preferred one to direct new users to in the #git IRC channel.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...