Live data from Hacker News

Using git to manage a website

toroid.org

41–50 of 52 posts

Re: Using git to manage a website

#41
That's similar to my private website (soultcer.com). I use git to create and store the content, and a wiki as content management system. It's nice to work on your website, and all you need is a git push for deploy. If I make a mistake or someone vandalizes the wiki, reverting is easy.

clickable: http://www.soultcer.com/

Edit: In case you are interested, the wiki software was written by a friend and is open source: https://github.com/patrikf/ewiki

Re: Using git to manage a website

#42
post #37
post #34

Have a question. This is nice for simple HTML. How about deploying site were you have to migrate the database etc. This approach wouldn't work. I use fabric with git right now, works well.

One solution that occurred to me, was to setup a(assuming MySQL)mirrored database. Another idea is to setup a MySQL dump script or something similar. Just a couple of ideas :)

I think it is good idea for static sites, for everything else you would be rediscovering fabric and similar tools.

Re: Using git to manage a website

#43
post #2

Is it bad, that I simply SSH into the server and do a "git pull"?

One advantage of the article's method is that it works if your workstation doesn't have a public IP address or is behind NAT / a firewall. It also works if you move around. With the article's method, you could have your laptop at home update your website, then go down to the local coffee shop and update your website from there.

Re: Using git to manage a website

#44
post #27

Earlier quoted context omitted.

Performance would be nightmarish. Git is super elegant and great, but not very performant. Imagine having to deltify a terabyte of data? Good luck with that!

wasn't it because he needed better performance one of the reasons Torvalds created git? http://en.wikipedia.org/wiki/Git_(software)

Although git usually has faster performance than most other VCS, that doesn't mean it can easily handle terabyte disk image files. :P

Re: Using git to manage a website

#45
post #9
post #2

Is it bad, that I simply SSH into the server and do a "git pull"?

To elaborate on dolinsky and the article, if your web server is doing a "git pull", it means it has ssh access into your workstation. If someone breaks into your web server, this means that they have ssh access into your workstation as well by simply using the keys on your web server. This is bad, very bad. If you push to your web server, only your public key is exposed if your web server is compromised.

I don't know if he meant that he git pulls from his workstation. I git push out to a bare repository on my server, and then I ssh in and git pull from the local bare repository into the project's working directory on my server. This doesn't leave the keys for my workstation on the server, but I still have to log in and git pull in the wd.

Re: Using git to manage a website

#46
It's probably worth checking out NestaCSM (http://effectif.com/nesta) if you're interested in doing this.

Sinatra in front, but all your posts are managed by Git and can be Markdown/Textile/HAML (or anything supported by Tilt iirc). Push it to Heroku if you want easy/free hosting.

Takes care of publishing an RSS feed, tags/categorisation, and a bunch of other nifty things beyond just generating a static site.

Example: http://blog.peepcode.com/

(disclaimer: I used to work with Graham who created it, but I genuinely think it's awesome and use it for almost every site I build now)

Re: Using git to manage a website

#47
The general approach of putting together your website on one machine, the coding machine, and publishing it to your server is one I use, although I prefer a complex build on my design machine and then rsync it with the server.

Checkout Chronicle (http://www.steve.org.uk/Software/chronicle/). I've put up a HN thread (http://news.ycombinator.com/item?id=2186798).

Re: Using git to manage a website

#49
post #30

Earlier quoted context omitted.

That's what I do, except I use svn rather than git.

Nice to hear I am not alone on this. The advantage I find is that it makes my deployments more explicit, and my pushes too and from the repository are as often as I feel. With GIT thats a moot point in the linked article so long as you are using branches for everything and remembering to push them as well, but sometimes I just want to fix something quickly and do so without a branch. I dont care what people say when…

You're not forced to use branches with git. They're just so easy that there's no reason not to.
Post reply on HN