Git to upload updated files to the site

    I don’t know what you use to upload changed files to the site, but I used to do everything manually. The tedious and stupid work is over, and at some point laziness, as the engine of progress, took its toll. Fortunately, by this time I began to deal with rails, and with them and with other charms of adequate development of web applications, including VCS. At some point, it dawned on me - after all, Git ( Project Site , Wikipedia ) already has everything to track changes, why not start using it for filling. All you need is SSH and an intermediate repository on the same server, inaccessible to the web server. Actually, like:

    Remotely


    Create a remote repository:
    mkdir -p git/project.git
    cd git/project.git/
    git init --bare



    Locally


    Create a local repository:
    cd /home/me/project
    git init


    We enter the files that do not need to be synchronized, for the rail on the makoshi I enter the following in .gitignore:
    .DS_Store
    log/*.log
    tmp/**/*
    config/database.yml


    Now you can make the first commit and send everything where it should:
    git commit -a -m 'Initial commmit'
    git remote add production ssh://me@my.server.ru/home/me/git/project.git
    git push production master



    Remotely

    It remains to clone the repository
    git clone /home/me/git/project.git

    In the future, when updating locally, you need to commit and git push, remotely - git pull

    Also popular now: