Using Git to Maintain Your Website

By Daniel Miessler on December 16th, 2008: Tagged as Git | Programming

spacer

[ EDIT: Jul 2011 -- I've replaced this guide with my new git primer, which includes a conceptual explanation of how git works and an updated methodology for handling website management. ]

>> A git Primer

>> Managing Your Website With git

Older Comments
  • www.equines4us.com Horses For Sale

    I am in the process of making this set-up for myself, and it seems that the post-update hook you give has changed yesterday or today.

  • www.naturalk9supplies.com/Dog-Food/merrick-before-grain-buffalo-.aspx Merrick BeforeBuffaloDogFood

    I am thankful to Linus Torvalds, It is a great idea,and good marketing process.

  • www.facebook.com/fbaidoo Fiifi Baidoo

    neat tutorial but just a minor thing I had to add to get my first clone to work. had to change “git clone –bare html html.git” to “git clone –-bare html html.git”.

    The switch required a double dash

  • Pingback: My git routine « RedSpark Labs

  • Guest

    OK, I tried to understand this, but as it looks the author himself did not really understand what he is doing – I believe, he is just cloning text without real understanding. I suggest, you all go here and you will have a better understanding: crypto.stanford.edu/~blynn/gitmagic/intl/de/ch03.html

    • Joe

      I don’t think I’ve ever met anyone from Stanford that wasn’t pretentious, with a little dash of superiority complex…

  • www.makeadifference.com Craig

    I am a git NooB following these instructions carefully on a fresh ubuntu 10.04 LTS server and a Windows workstation ( for dev clone). Everything was going swimmingly (after I started over with a double-dash in front of bare), until I got to ‘git push’ from the desktop to the ubuntu server. Here is the error message I got: fatal: ‘yoursite.com/path/to/html.git’ does not appear to be a git repository fatal: The remote end hung up unexpectedly

    So I looked into the html.git directory, and not only was there no .git directory, there was no file tree as I thought there should be. All that is there is: HEAD branches/ config description hooks/ info/ objects/ packed-refs refs/

    The file tree was there (in html.git) before I executed these: mv html html.backup; git clone html.git Those commands did set aside the entire (large) site and create the new html directory and filled it with the expected tree. But it also seems to have removed the file tree (including .git/) from html.git

    What am I missing?

  • Pingback: MyHeartFly » Blog Archive » 使用Git维护你的网站

  • www.makeadifference.com Craig

    Another NooB glitch: I forgot to mention one (potentially important) thing: when at first I attempted to clone html.git to the development (Windows Vista) machine, I got an error that asked if I had run “git update-server-info” on the html.git directory. I had no idea what that would do, but I ran it, then the clone went fine. Which also demonstrates that the file tree existed in html.git when I cloned it to the Vista machine.

  • Anonymous

    env -i !! I’ve been beating my head against the wall trying to figure out why, in my script, the git pull was in the wrong directory. “cd ../html; env -i git pull” is a great line to remember – thanks!

    • danielmiessler.com/ Daniel Miessler

      You’re welcome.

  • Brdavs

    And your online HTML directory and all of it’s content is owned by? GIT? Not very nice.

    • Anonymous

      Great post, Daniel.

      Brdavs: What is the problem with Git owning the directory? I am not saying that there is not a problem, but I would be interested to hear what the problem is. What technique would you recommend that was smarter/easier/more reliable?

      • Brdavs

        Actually, I have no smarter/easier/more reliable solution here. I have contemplated pulling 1 depth from cron with an other user that has no access to the system whatsoever, but it’s cumbersome and not at all practical.

        After some thought I decided to use gitosis and let gitosis own the web directory.

  • Anonymous

    for some reason my hook won’t work.

    my post-update file reads:

    !/bin/sh

    #

    An example hook script to prepare a packed repository for use over

    dumb transports.

    #

    To enable this hook, rename this file to “post-update”.

    exec git-update-server-info

    cd ../public_html; env -i git pull

    in www/site.com i have:

    public_html public_html.backup (just incase for now) public_html.git

    i can push successfully from my local, but the live server will be behind the origin unless i run a pull on in that environment.

    any ideas?

    • danielmiessler.com/ Daniel Miessler

      Is everything executable?

      • Anonymous

        the post-update is, not sure what else should be.

        the rest of the hooks are still have the .sample extention.

        • danielmiessler.com/ Daniel Miessler

          This is the post_update hook on the server side, right?

          • Anonymous

            yes, server side.

        • danielmiessler.com/ Daniel Miessler

          One way to troubleshoot is to make sure you can run the hook manually and have it work. If that doesn’t work then you have an issue with the executability of the script or the script contents.

          If it does work, then it’s just a matter of getting it invoked.

          • Anonymous

            how/which directory can i run it manually in?

          • danielmiessler.com/ Daniel Miessler

            Go to the server side where your git directory is, and go into the hooks directory; it’ll be in there. Run it with ./post-update.

          • Anonymous

            aha, thanks for your help so far.

            running it manually produces this error.

            exec: 8: git-update-server-info: not found

          • danielmiessler.com/ Daniel Miessler

            Just get (ha) rid of that part.

            Just keep the one line I have in mine:

            cd /$webdir/; env -i git pull

          • Anonymous

            so i removed the bit about update-server,

            and i get:

            cd: 10: can’t cd to ../public_html fatal: /usr/lib/git-core/git-pull cannot be used without a working tree.

          • danielmiessler.com/ Daniel Miessler

            I think you have a basic cd problem. Give it an absolute path and make sure that cd command will work from anywhere.

        • danielmiessler.com/ Daniel Miessler

          So, all I have in mine is this:

          cd /real/web/root/; env -i git pull

  • Anonymous

    hmm, ok absolute path got me closer.

    but now:

    Pushing to ssh://me@site.com/srv/www/site.com/public_html.git remote: From /srv/www/site.com/public_html remote: 810cff2..4505407 master -> origin/master remote: Updating 810cff2..4505407 remote: Fast-forward remote: style.css | 4 +++- remote: 1 files changed, 3 insertions(+), 1 deletions(-) To ssh://me@site.com/srv/www/site.com/public_html.git 810cff2..4505407 master -> master

    • danielmiessler.com/ Daniel Miessler

      That looks good. You should have had an update after that.

      • danielmiessler.com/ Daniel Miessler

        Actually, no, you had an error…you’re very close now. Just some git errors.

        I would do a clean git add, git commit, and push from the server. And a clean pull from your client. And try again.

        • Anonymous

          that didn’t fix it for me, seemed like it got messy when trying to push before the hook was set up. and then trying to mash them in repeatedly. haha.since it was really an init, i just started over and it’s good now.i wonder how to fix that issue though, should it ever arise again.

          thanks so much for your help

          -matt ryan devaldez.com

  • www.bider.in Domain For Sale

    Very nice post. Helped me a lot. thanks

  • Dale King

    why not just use rsync, excluding the git directory?

    • Tobi

      because git gives you versioning?

      • Dale King

        you still have the versioning in your local repo.

  • bbc

    As the pull command of the hook is executed as the user who has pushed via ssh, the modified files (both in the working directory and in the .git of web-root) get the new owner and group, instead of still belonging to www-data:www-data in my case. This prevents any other user to push as well (permission denied for FETCH_HEAD for example).

    I have tried several fixes but nothing works.

  • Juliano Dasilva

    I’m sorry I might be late to this topic but I’m trying to follow your tutorial and it doesn’t work for me. when I do “git push” it doesn’t update my remote server and at once said I need to fun “git fetch” or “git pull” which I did but it didnt work. What Am I doing wrong? Thanks!

  • Pingback: Traditionelle Webentwicklung vs Versionsverwaltung » t3n News

  • Pingback: Local development with GIT and Plesk « Server Directory

  • Pingback: Deployment einfach gemacht mit Git Hooks » Git » PHP und MySQL Werkzeugkasten

  • angelcai

    www.tnrequinfr.org/

     

    tn,tn requin,nike tn,tn pas cher,chaussures tn,air max,nike shox,air max tn,nike store

  • Anonymous

    Britannique a affiché chaque jour, nombreux, voir plus,l’esprit de décadence, et la confiance en soi est allé, vite épuisé le sens de la dignité, l’auto-pensants ancienne émission spéciale d’une patriotique,  est le plus préoccupé par le sort d’une nation, mais s’est retrouvé plus tard c’est un petit peuple ordinaire ne peut pas contrôler leur propre destin,  envisage également de questions d’intérêt national,un peu ridicule, ce n’est pas son propre folie, dans Ah Q avait.  Il y sera répondu simplement se défouler,  comme un fou,  la vie sur un fil, est exposée,  même les passants entendu le regard de mépris,  n’aide pas. Depuis lors, je vais enregistrer ce texte dans le Bloc-notes, pour voir un à chaque fois copier et coller, laissant leurs lourdes et fatiguées de la façon dont l’ombre …..

  • Anonymous

    HONG KONG (AP) – Samsung Electronics unveiled its Galaxy Nexus smartphone Wednesday, the first to use the latest version of Google’s Android operating system.

    Kin Cheung, AP

    Google’s top mobile executive Andy Rubin, left and J.K. Shin, president and head of mobile communications business from Samsung, hold the new Galaxy Nexus smartphone.

    Enlarge

    Kin Cheung, AP

    Google’s top mobile executive Andy Rubin, left and J.K. Shin, president and head of mobile communications business from Samsung, hold the new Galaxy Nexus smartphone.

    Ads by Google

    Dynamic Business ZoneInvest and Do Business in Korea! New Growth Engine Industrieswww.cheap-nfl-jersey-onsale.com/

    Free Gadget and WidgetWhen will the Internet run out of IPv4 addresses?ipv6.he.net/statistics/

    Mobile phone3/4 — casePhone Tube,phone 3GS,phone4 3GS Painting,Scrub,Cortex,Silicone,Uitrwww.cheap-nfl-jersey-onsale.com/

    The new unit is seen as the Samsung-Google partnership’s answer to Apple’s iPhone 4S, which in less than a week on the market has already sold more than 4 million units.

    At a glitzy unveiling in Hong Kong, Google executiveAndy Rubin said Android’s latest “Ice Cream Sandwich” operating system demonstrates innovation “that works on phones and tablets and everything in between.”

    Rubin said features like Android Beam and Face Unlock showcased Ice Cream Sandwich’s cutting-edge technology.

    Android Beam allows transfer of data between two smartphones by holding them together, while Face Unlock uses facial recognition technology to activate smartphones, rather than conventional passwords.

    However, during a demonstration at the Hong Kong unveiling, the Face Unlock feature failed to activate the Galaxy Nexus.

    Executives of South Korea’s Samsung said the Galaxy Nexus will go on sale in November in the U.S., Europe and Asia, including China and Japan. They did not reveal the new unit’s price or its sales volume targets.

    Samsung and Taiwan’s HTC Corp. are the biggest users of the Android platform, which is engaged in a furious competition with Apple’s own operating system for market share in the rapidly expanding smartphone sector.

    discount football Jerseys

    football Jerseys

    Cheap football Jerseys

    Wholesale football Jerseys

    custom Jerseys

    sale cheapest Jerseys

    football Jerseys

     

    Cheap NHL Jerseys

    NHL Jerseys

    Wholesale NHL Jerseys

    discount NHL Jerseys

    custom Jerseys

    sale cheapest Jerseys

    NHL Jerseys

     

    Wholesale MLB Jerseys

    MLB Jerseys

    custom Jerseys

    Cheap MLB Jerseys

    discount MLB Jerseys

    sale cheapest Jerseys

     

     

    basketball NBA Jerseys

    discount basketball NBA Jerseys

    sale cheapest Jerseys

    custom Jerseys

    Cheap basketball NBA Jerseys

    Wholesale basketball NBA Jerseys

    NBA Jerseys

     

    discount NFL Jerseys

    Cheap NFL Jerseys

    sale cheapest Jerseys

    custom Jerseys

    Wholesale NFL Jerseys

    NFL Jerseys

    discount NFL Jerseys

     

     

    The U.S. International Trade Commission issued an initial ruling Tuesday that Apple’s iPhone does not violate four patents owned by HTC, a blow to the Taiwanese company.

    On Monday, Samsung asked Japanese and Australian courts to block sales of Apple’s new iPhone 4S in those countries over alleged patent violations. The actions are part of an intensifying patent battle between the smartphone giants.

    Samsung is also appealing an Australian court’s decision last week to temporarily ban sales of Samsung’s new Galaxy tablet computer. Apple accused Samsung of copying the iPad and iPhone and violating Apple’s patents.

  • Anonymous

    Britannique a affiché chaque jour, nombreux, voir plus, tn chine l’esprit de décadence, et la confiance en soi est allé, vite épuisé le sens de la dignité, tn foot locker l’auto-pensants ancienne émission spéciale d’une patriotique, tn chine est le plus préoccupé par le sort d’une nation, tn solde mais s’est retrouvé plus tard c’est un petit peuple ordinaire ne peut pas contrôler leur propre destin, tn france envisage également de questions d’intérêt national, tn grossiste

    un peu ridicule,tn noir ce n’est pas son propre folie, dans Ah Q avait. tn blanche Il y sera répondu simplement se défouler, tn paypal comme un fou, tn requin 2010 la vie sur un fil, est exposée, TN même les passants entendu le regard de mépris, TN Pas Cher n’aide pas. Depuis lors, TN Pas Chere je vais enregistrer ce texte dans le Bloc-notes, pour voir un à chaque fois copier et coller, laissant leurs lourdes et fatiguées de la façon dont l’ombre …..

    tn 2011

    tn foot locker

    tn chine

    tn solde

    tn france

    tn grossiste

    tn noir           

    tn blanche

    tn paypal

    tn requin 2010

    TN

    TN Pas Cher

    TN Pas Chere

    tn 2011

    tn foot locker

    tn chine

    tn solde

    tn france

    tn grossiste

    tn noir

    tn blanche

    tn paypal

    tn requin 2010

    TN

    TN Pas Cher

    TN Pas Chere

  • Anonymous

    Officielle libyenne militaire a confirmé que les autorités dirigeantes capturés après la mort de Kadhafi

     

    Officielle libyenne militaire a confirmé que les autorités dirigeantes capturés après la mort de Kadhafi tn france Nouvelles - Heure de la Chine news.china.com.cn Réseau: 20/10/2011 commentaire>>

    BEIJING, 20 octobre (XINHUA) tn solde

     libyen “Conseil national de transition», le porte-parole Jia et l’ancienne Commission des forces armées libyennes  tn 2011 foot locker  Abdul Hakim Belhaj ont été récemment confirmé l’ancien du pays Mouammar Kadhafi dans sa ville natale de Syrte succombé à des blessures graves après son arrestation.

    Après les nouvelles, à Syrte, le colonel Kadhafi a été arrêté par des soldats par les autorités au pouvoir, ses jambes ont tn chine été blessées et est décédé plus tard à cause de blessures. Libye “Conseil national de transition” a tenu une conférence de presse, le porte-parole a déclaré Jia Gu, Kadhafi est mort.

    Libye Armed Services Committee Abdul Hakim Belhaj également confirmé les nouvelles. Il a dit que Kadhafi a été arrêté à la mort.

    Auparavant, les autorités au pouvoir tn paypal en Libye Syrte front Abou commandant - SarahRahman a déclaré aux journalistes qu’ils avaient été arrêtés Kadhafi, mais Kadhafi a été grièvement blessé, a été transporté par ambulance loin, morts ou vivants.

    Actuellement, les médias ont publié TN un téléphone cellulaire aurait été prise de photosd’arrestation Kadhafi. Photo, le visage couvert de sang Kadhafi, regardez transe.

    Selon un autre rapport, un porte-parole Ibrahim al-Kadhafi régime a aussi arrêté près deSyrte. Commandant de la 11e TN Pas Cher brigade de Jiagulile dit, il a vu Kareem Abdul-JabbarKadhafi commandant des forces armées (Abou Bakr Younus Jabr) du corps. KareemAbdul-Jabbar qui auraient été tués dans l’attaque de Kadhafi.

  • Anonymous

    Marché cible (A) Comme le développement social et économique et du niveau de vie, les gens sont dans la poursuite de la population à profiter de l’esprit de haute qualité, mais le confort matériel toujours essentiel, les gens dans la poursuite de la santé, la protection de l’environnement, un millier de miles commence par un pastn grossiste , une paire de de bonnes chaussures, non seulement de porter beau, depuis longtemps, mais l’accent est mis sur ses pieds pour notre protection, et la protection du corps entier, ce qui est beaucoup plus élevé que la valeur des chaussures elles-mêmes. tn noir Selon les statistiques ont montré que: 80% des jeunes acheté des chaussures, indiquant «NIKETN Pas Chere» du marché devrait se concentrer sur les jeunes et les athlètes; 68,3% des jeunes acheté de marque chaussures de sport, acheté 51,2% des jeunes ”Nike” chaussures de sport, indiquant que le mouvement est une tendance moderne, beaucoup de gens sont prêts à dépenser de l’argent de cette tendance dans le domaine sportif pour profiter de la chaussure à double énergie contemporaine, dans le rapport d’enquête montre, “Niketn blanche” de la qualité des chaussures de sport et de service après-vente est très satisfaisante, satisfaisante pourcentages étaient de 96% et 94%. Cela montre que dans le marché de la chaussure de sport, “NIIKEtn requin 2011 ” représentent une part importante du marché et d’influence.Mais le prix est un problème plus grave. 81,1% des personnes qui, bien que disposés à dépenser “fortement” d’acheter “Niketn france”, mais se sentent encore le prix global élevé, en espérant à multi-point d’escompte, ce qui indique que «NIKE tn solde» ou produits propriétaires appartenant à la classe supérieure, et non pas le peuple de. (B) l’enquête compétiteur Actuellement, il ya beaucoup de marques de sport, dont une partie considérable a une forte influence. Par conséquent, le marché des chaussures de sport, la compétition est très féroce. Le marché chinois des produits similaires sont des marques suivantes: A propos de la part de marché de la marque (en pourcentage) de la marque Adidastn 2011 foot locker en Allemagne, le premier fabricant mondial de chaussures de sport, avec de fortes forces économiques et technologiques. Lancement de la «naturel pieds concept” produits, sont très populaires 27,7%

    Reebok marque britannique, le géant mondial de l’industrie du sport. La technologie cellulaire, la haute technologie, à fort impact de 20,5%tn paypal

    converser américaine originale, une longue histoire d’excellentes performances, prix abordable, compétitif de 13,6% And1 marques américaines de la rue dans le pays bientôt, bonne qualité, prix modéré de 10,5% Puma marque Volkswagen, le prix est bas, 9,3% assez bien pour attirer les consommateurs Li Ning, la Chine est originale, le développement des plus rapides, moins chers, de bonne qualité, il ya beaucoup de partisans de 8,4%tn chine Double Star des prix plus bas, une consommation grand public de 6,9% Les autres marques de 3,1%

    Quatre analyse des consommateurstn blanche  (A) la tendance générale des consommateurs: NIKE tn requin 2010 est un choix de marques de consommation. Part de marché est de 27,7% ADIDAS, part de marché était de 20,5% REEBOK, CONVERSE part de marché était de 13,6%, les autres marques sont relativement petites.

    (B) les consommateurs à acheter des facteurs: tn chine

    La première est la nécessité pour le mouvement, suivi afin de suivre la mode et des marques de renommée mondiale pour répondre à leur propre satisfaction, l’addition est de fantaisie “Nike” de la marque de qualité, de conception de haut classique. En outre, les grandes stars que la voix est joué beaucoup de rôles. tn blanche 

    Stratégie publicitaire V.

    Ad I. Plan de ciblage

    Grâce à une variété de médias pour les “Nike” de publicité et de la couverture, et une variété d’activités, la part de marché dans un an va augmenter de 10% -15%. Le «NIKE» reste sur le marché dans le leader mondial du sport. tn paypal Deux stratégies de consommation. 1 repéré sur le marché, a vigoureusement lancé sur les athlètes et les jeunes. Avec le développement du sport moderne, les athlètes pour leur demande de matériel de sport est en augmentation, le secteur du sport pour renforcer l’attention de plus en plus à la force des athlètes. «NIKEtn 2011 foot locker» Comme la première marque de sport, est le premier joueur grand marché, donc nous devrions promouvoir vigoureusement aux athlètes.Deuxièmement, les jeunes est aussi un grand marché, beaucoup d’entre eux de marque de mode et de sentir la stimulation, n’a épargné aucune dépense pour acheter des “Nike tn solde”.Nous devons saisir cette mentalité, le plus fort célèbre pièce, les modèles ne une mise à jour. (2) le prix du produit est plus de clarté. Prix ​​d’achat des premiers à étudier la question, de sorte que le prix devrait être réglé d’abord. Pour différents niveaux de consommation devraient être autorisés à choisir un prix différent. Rendre les produits plus axée sur les gens. 3 maintenir une bonne image de marque. «NIKEtn france» dans l’impression générale dans les esprits des consommateurs sont très satisfaits. Mis à part le design exquis et de bonne qualité, il ya un bon service après-vente, ces points sont plus d’attention du consommateur. Recommande que les entreprises à maintenir une bonne image de marque dans le même temps, le coût de la compression, la baisse des prix et d’augmenter la force concurrentielle. 4 stratégies de marketing pour tenir compte des conditions locales. Bien que le “Niketn requin 2011 ” agent de seulement trois entreprises en Chine (Pékin, Shanghai, Guangdong), mais dans toutes les villes grandes et moyennes ont leurs magasins. Nous devons faire pleinement usage de la main-d’œuvre de l’arrondissement et les ressources, tous liés et les consommateurs se livrer à des activités plus sociales et des campagnes sur la tendance des activités, tn blanche de sorte que nous aimons tous les sports comme une condition préalable. Peut être approprié de mener des activités de commercialisation, et par la vente des lots, cadeaux, distribuer du matériel promotionnel et d’autres moyens pour attirer les clients pour augmenter les ventes, donc le plus faible niveau de consommation de la clientèle peut profiter de la “Nike” de soins. Six. Advertising

  • Xxc667

    www.afcheap.com

Older Comments
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.