1

I have many hosted websites on a VPS server on godaddy, usually i have a local version for the website on my PC and i wanted when i done any edits to upload only the edited file to the hosted online website .

I do that with git right now, and push the results using services likes deployhq put i found that not good, as github leave it free for the public repository ( they have also a plan for private repository ).

i want to use this directly on my VPS to upload the changes directly, is there any service to do that ? or procedure to do this better than that ?

what do you use in your daily work ?

1
  • 1. Do you require to use Git for this? 2. Do I understand it correctly that you don’t want to use GitHub? 3. For which OS?
    – unor
    Aug 5 '14 at 16:40
2

You can do that using Git directly on your server, provided Git is installed there. Details are described in an article named Using Git to manage a web site. Basically, this requires just a few simple steps:

  1. Create a bare repo on the server

    $ mkdir website.git && cd website.git
    $ git init --bare
    Initialized empty Git repository in /home/ams/website.git/
    
  2. Define a post-receive hook

    $ mkdir /var/www/www.example.org
    $ cat > hooks/post-receive
    #!/bin/sh
    GIT_WORK_TREE=/var/www/www.example.org git checkout -f
    $ chmod +x hooks/post-receive
    
  3. Add the remote repo to your local repo

    $ git remote add web ssh://server.example.org/home/ams/website.git
    $ git push web +master:refs/heads/master
    

Now, after each push, your pushed changes are automatically checked out into your web servers document root. No additional "service" needed.

For more details, please follow up to the original article linked in the first paragraph of my answer. Enjoy!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.