Because of the frequent number of revisions that I was making to my projects, I decided that it was about time that I set up a SVN repository. Although I could have done this locally, I decided to make good use of my space on Bluehost and set one up there.
Since SVN is not technically supported by Bluehost, you’re pretty much on your own when it comes to installing it on your account. However, Google once again comes to the rescue and I was able to dig up some instructions.
So here we go:
1. Get ssh access
In order to get ssh access, you’ll need to send Bluehost a copy of some sort of picture ID. The easiset way to do is to login to your Bluehost control panel and click “SSH/Shell Access” under the Security category.
From there, you’ll want to submit a Technical Support request with a scan of one of their required IDs. I sent in a scan of my driver’s license. Bluehost support is really fast, so you should have shell access by the next day
2. Installing SVN
Once you’ve gotten shell access (you’ll get an e-mail from Bluehost Support), go ahead and ssh into your account; its time to install SVN!
After some tinkering around, I was able to install SVN by following the script at this link: http://www.bluehostforum.com/showpost.php?p=51455&postcount=19
In the second half of the post, the poster tells you to edit your .bash_profile. That’s wrong, you should actually edit your .bashrc and edit your PATH there instead.
If the script in the link above didn’t work for you, your account might be hosted on a 32-bit server. If that’s the case, try following the script at this link: http://www.ear-fung.us/2008/02/bluehost-subversion-svn-xcode-bliss/.
Be careful with the code snippets though, the poster has a tendency to leave out the necessary spaces/semicolons between commands.
3. Making Your First Repo
By this point, SVN should be installed. So lets make a repo!
First, create a root folder where all your repositories will be sold. For example, I created a folder called repo/ in my home folder:
mkdir ~/repo
cd into your repository folder and execute the following line to create your repository:
svnadmin create project_name
where project_name is the name of the project you want to create
You can access your projects will now be hosted on the following link:
svn+ssh://username@hostname/homeX/username/repos/project_name/
where username is the same username that you used to ssh into your account. Replace the X in homeX with your actual home number (you can find this by executing pwd in the shell; mine was home5).
4. Notes for Windows + Subclipse + TortoiseSVN
Update: I’m using the new Galileo build of Eclipse now and it seems like this step is unecessary. It looks like Eclipse now supports SVN+SSH using SVNKit.
If you’re working on Eclipse with the Subclipse plugin on Windows, chances are Subclipse will complain that: “svn: Can’t create tunnel: The system cannot find the file specified.” when you try to do a checkout.
To fix that you’ll need to:
- Install TortoiseSVN
- Create an Environment Variable called
SVN_SSHthat points to theTortoisePlink.exeexecutable.To do this, go to Start, right-click Computer, select Properties, select Advanced System Properties in the left menu bar, go to the Advanced tab, select Environment Variables, under System Variables, click New. EnterSVN_SSHfor the Name, and the path to the executable in the variable name:C:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe(the \\ is essential!).
Restart Eclipse and you should be able to check-out now
5. Public Key Authorization
Even with this setup, you’ll find that Subclipse is asking you for your password up to 3 or 5 times per checkout. This is insanely annoying, so let’s set up ssh authorization using public keys.
Following the link here: http://tortoisesvn.net/ssh_howto, you can generate a public/private key pair so that you can ssh+svn with a lot less hassle.
One other note, use the Configuration Variant for Pageant (you can download it from the Putty homepage) to make your life a lot easier!
Other Notes:
Because the most “basic” Bluehost account does not provide you with multiple ssh accounts, you can only use svn with one account. Apparently there are some hacks out there to give you more than one account, but I think its more trouble than its worth
And there you have it, your own personal repo!
5 Comments
Great tut James. I’m on hosted by hostmonster and since bluehost is run by the same guy (see http://www.mattheaton.com) this may come in handy for me in the near future.
Cool post, thanks for sharing!
Great tutorial! I think I have everything set up properly remotely but I am having problems with Subclipse.
When you create your repository:
svn+ssh://username@hostname/homeX/username/repos/project_name/
Let’s say I created a subdomain called svn.hidden2010.com which points to /home/username/public_html/svn
When I try
svn+ssh://username@svn.hidden2010.com this should be the same thing right?
However, I get the following error:
Location information has been specified incorrectly
svn: No repository found in ‘svn+ssh://svn.hidden2010.com/hidden
Keep location anyway?
Um, I’m actually not too sure! I’m a bit of a web noob, but I would think that your checkout path would look something more like svn+ssh://username@svn.hidden2010.com/ unless ur repo name is hidden, in which case that explains the 2nd line svn: No repository found in ‘svn+ssh://svn.hidden2010.com/hidden
My next suggestion would be to do a checkout using the “full” path, that is svn+ssh://hidden2010.com/home/username/public_html/svn/ to see if that works. If it works well at least you know the repo is up and running.
Sorry if I couldn’t be more helpful :S
After lots of retrying, I think the problem lied where I thought I could create the repository in a subdirectory of home (namely public_html)… Which was leading to problems.
I did it again a little bit differently
cd ~
svnadmin create svn
Then in subclipse:
1. Right click on your project
2. Team –> Share Project
3. Fill in:
svn+ssh://username@domain/home/username/svn
username: username
password: password
This allowed me to create & commit a project WITHIN the svn repository.
Thank you very much for the tutorial.
3 Trackbacks
[...] My friend James Ma has a great post on setting up SVN on BlueHost: http://www.pioverpi.net/2009/06/18/installing-subversion-on-bluehost/ [...]
[...] follow up on my previous post, if you don’t have a hosting service but would still like to set up Subversion for your own [...]
[...] [7] http://www.pioverpi.net/2009/06/18/installing-subversion-on-bluehost/ The second link and the last link also introduce how to set TortoiseSVN via SSH to the subversion [...]