Skip to content

Deploying Your Git Repo To Arvixe Web Hosting

by arlo on May 5th, 2012 

Git is rapidally becoming more and more popular and while is a great way to store your projects you will need a way to deploy your web app to your shared hosting. is one of the most affordable and reliable shared hosting providers I’ve come across and a perfect example for demonstrating how to deploy your git repo into a shared environment like

1.) Setup SSH Access with Arvixe

Make sure you have SSH access. Shared hosting accounts with Arvixe do not come with SSH access by default. You will to go to the support chat and ask for SSH access, this will only take minutes and is effective immediately.  Once they give you access, make sure you can login. Here is how you would SSH into your account with your Arvixe username and password.

Enter your password: *********

Get your public key into Arvixe.Your public key is located on YOUR computer, ~/.ssh/
Create the following file on Arvixe and copy the contents of your public key into this new file: ~/.ssh/authorized_keys.

Incase you don’t have ~/.ssh/ on your computer, run ssh-keygen in your console and hit enter all the way through. At the end of that, you will have the ~/.ssh/ file on your computer.

You can create a new file on Arvixe with the following command: touch ~/.ssh/authorized_keys.

Configure your repo on Arvixe. First, you need to set a config option in your Arvixe repo to accept pushes into this working directory. While SSH’d into your Arvixe account, navigate to your repo directory and run this command:

git config receive.denyCurrentBranch ignore

Finally, you need to set a git hook that will refresh your working directory after the push has been accepted. Save the following content in: PATH_TO_REPO/.git/hooks/post-receive.

# Save this in: PATH_TO_REPO/.git/hooks/post-receive
GIT_WORK_TREE=../ git checkout -f

Then, make it executable with chmod +x PATH_TO_REPO/.git/hooks/post-receive

2.) Setup Your SSH Config Locally

Automate SSH connection for your Arvixe account.
In order to add Arvixe as a git remote, you want to setup your username as the default and you will not be using your password for authentication. You need to edit/create the file ~/.ssh/config on your computer. Then add this content.

  PreferredAuthentications publickey

Now, you should be able to login with ssh without needing to type your password or include your username. If this is not the case, start over at step 1.

3.) Setup Arvixe Account as a Git Remote

Add your domain as a remote. On your computer, navigate to your git repo and run this command.

We are assuming your git repo is in WWW. In reality your repo can be anywhere on your Arvixe account, just change “www” with the correct path below.

git remote add arvixe-live

Now, you can make your changes to your repo and when you are ready to push your changes:

git push arvixe-live master

Something to think about

With this setup it is now easy to have a “dev” site on your Arvixe account too. SSH into Arvixe and replicate your repo into a different folder (~/www/dev). Locally, setup a new remote:

git remote add arvixe-dev

So, from now on you can git push arvixe-dev to test out your new changes. When you are ready to make your changes live: git push arvixe-live

From → git

  • Pingback: Deploying Your Git Repo To Arvixe Web Hosting | Arlo Carreon | Webhost

  • Pingback: How to Deploy Your Git Repo Into a Shared Environment Using Arvixe | Arvixe Blog

  • Pingback: Getting started with Git - Full On Design

  • sparkica

    You made my day :) Only yesterday I realized I have my own git on Arvixe… and today I’m already pushing code. Thanks!

  • Arlo Carreon

    I am glad this helped! Since git allows for push via plain SSH, things like this are possible. Also, almost any shared hosting will have git-client installed and if they don’t, you can FTP the git binary to that shared hosting.

    [This is the basic git binary you have on your computer.]

    In essence, any hosting that grants SSH access you will [most likely] be able to push your git repo using that SSH account. :D

  • sparkica

    So little time, so many things to learn! :D I didn’t know about all that (hosting having clients etc.). Thanks again. Most of my projects are on Github (or company’s server) and didn’t even feel the need for my own git server… well until today. I was playing with octopress and felt the urge to create new blog on my server as git repo, setup some hooks and the usual. I found the link to your blogpost on arvixe’s blog and … you know the rest :)

  • Brian

    Hey, great step by step. Here is one missing step though, and thought it could be useful to others:
    After this step:
    Configure your repo on Arvixe. First, you need to set a config option in your Arvixe repo to accept pushes into this working directory. While SSH’d into your Arvixe account, navigate to your repo directory
    And before you execute the next step, you may need to initialize Git if you haven’t used it before.
    To do that, run this command:
    git init
    Then do the next step (pick up right where you left off), run command:
    git config receive.denyCurrentBranch ignore
    And just continue with the rest of this tutorial.

    Hey, thanks again, it was a huge help!

  • Arlo Carreon

    Good point! I had thought about this before. My main concern is that I might steer some beginners away by assuming they have not started a repo in that directory. I have tried to focus this blog post on those of us who ALREADY have a git repo on shared hosting, but haven’t been able to push directly to it.

    I may or may not have come across as clear while writing this post, but those were my intentions.