SVN in Shared Hosting with Hostgator

I’ve wanted to setup an SVN server for personal use, and to keep files current between my fiance and me when we’re working on the same project.

So far I’ve resorted to using a flash drive, but sometimes it takes a while to check which machine or flash drive has the latest copy of my program source, or even sometimes losing the flash drive, and potentially having the latest copy lost.

Well, I switched hosts to hostgator not too long ago from Godaddy, which had been great for my static+php sites, but awful for wordpress, due to  fetching from the database. Sometimes 60 seconds to load a basic page! (5 seconds max with hostgator, BTW)

I like hostgator a lot better, they make it easy to run CRON jobs, but could I finally have a basic SVN server using them?

Yep, here’s how I did it, although it took over 3 hours of pulling out hair:

How to create an SVN on hostgator

I mostly found my information based on this article (although it didn’t work for me – invalid port error):
http://keithics.com/blog/personal-thoughts/svn-in-shared-hosting-with-hostgator

You need to download
TortoiseSVN (SVN Client)
and
Putty (for SSH)

Step 1

First thing first, you have to enable SSH on your hostgator server. From their wonderful support portal:

  1. Login to the HostGator billing tool, GatorBill.
  2. Go to ‘Hosting Packages’ and click ‘View Hosting Packages’.
  3. Find the package you want to modify and click on ‘Enable Shell Access’.

Step 2

Install TortoiseSVN, and just put the putty.exe somewhere you can find it.

Open Putty, under ‘Host Name’ enter your domain name, and under port enter 2222, then enter a name ( I used ‘puttyinterface’) into ‘Saved Sessions’ and click ‘Save’. Now double click on the puttyinterface below to connect.

Now, you’ll get a strange popup about putting the servers host key into the registery. this actually adds a key to the registry that allows tortoisesvn to connect!! (click yes)

When it loads (to something like a dos prompt), login using your CPanel username and password (nothing will show when you type in your password, but it works)

Next, create a repository using the command : ‘svnadmin create myrepo2’

(myrepo2 being the name of the svn folder you want on your server)

Step 3

Lastly, just create a folder on your computer where you want the repository to download to, right click on it->SVNCheckout, and in ‘URL of repository’ enter:

svn+ssh://doomtoo@puttyinterface/home/doomtoo/myrepo2
(replacing doomtoo with whatever your CPanel login was, and myrepo2 with whatever you named the svn folder through putty in the previous step)

Now type in your CPanel password when it prompts you (sometimes several times) and it will create the repository!

Now you can create files in your local folder, right click on it and click ‘SVNCommit’ to commit files to svn on your server, and right click and select ‘SVNUpdate’ to grab any changes commited to your folder!

This will definitely save me some time staying up to date with the latest copies of my program, as well as get rid of my flash drives, and help keep projects organized with other people!

Let me know if you found this helpful, or found an easier way to do it!

Bookmark the permalink.

14 Comments

  1. Great article! I got my setup to work with it. Just a quick question, is there any way to have multiple users for the SVN? I don’t really want to give out my cpanel username/password to anyone.

    Thanks again for the great tutorial.

    • Thanks for the feedback!
      I’m not sure how to add more users… I found this article on adding more users via SHH:
      http://support.bryght.com/vps/ssh-sftp-user

      But when I tried to get root access (sudo sh), it gave me the error:
      ‘doomtoo is not in the sudoers file. This incident will be reported.’….

      It might be the case that only admins have the ability to create users, but I’ll still look into it more.

  2. And in fact this page gives info on setting users and permissions for an svn repository, but still wont let me login (probably due to the user not being setup to access ssh?)
    http://stackoverflow.com/questions/81361/how-to-setup-access-control-in-svn

  3. Thanks for the write-up man !
    However, I think Hostgator they do not allow setting up a SVN repo on a Shared-Hosting account.
    http://support.hostgator.com/articles/svn-explained

    Not sure if doing this may result in account suspension.

  4. Great article. I just wish they would give resellers the same SSH controls versus trying to bleed them dry at $10 a pop per sub-account.

  5. Thanx for the article.

    I got an error from Putty;
    Unable to open connecion to
    puttyinterface
    host does not exist

    any help?

  6. Thanks for the well written walk through. I’m tried setting up a repository for a while now but thanks to the info you shared I can finally take keep my code in one place and not worry about version issues.

  7. just to confirm shared hosting hostgator + svn = not possible?

  8. Thanx for the article.

    I got an error from Putty;
    Unable to open connecion to
    puttyinterface
    host does not exist

    i am using shared hosting

  9. I’d like to host a repository in my shared hosting provided by Hostgator. What is the conclusion? Can you host the repository there even though Hostgator says you can’t here, http://support.hostgator.com/articles/svn-explained?

    Also, when you say, “Install TortoiseSVN, and just put the putty.exe somewhere you can find it.” do you mean install these on Hostgator or on your personal computer?

    • I’ll have to check again- when I wrote it, it was working, but it sounds like it’s no longer working for most people that have replied.

      But you do have to put putty on your personal computer- TotoiseSVN uses it (which is also installed locally).

  10. Works great for me, and is perfect for my situation. Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *