Setting up source control on Host Monster

I’m collaborating on a small project with a friend that means we’d like to share some source code around. As I have dynamic IP and don’t have a server at home always on the Internet I thought my web space on Host Monster (incidentally where this is hosted) seemed to be an ideal place to host this. My initial thought was to set up a CVS repository. CVS appears to be installed on my Host Monster account already – brilliant. However it seems that for anyone to access it they would have to have root ssh login to my account. Not that I don’t trust my friend but I don’t really want to start giving away root access to my web space.

So I thought about looking for other solutions – one that came to mind is svn so I looked into that and found this informative post on how to do what I wanted but with subversion, albeit on a different web host. I also found a helpful thread about how to install Subversion on Host Monster. Now I’m a newcomer to subversion although I know as a user it works in almost the same way as CVS.
Sadly it seems that there is no way to do this with CVS that I could find.  It may have been possible by tunnelling a pserver connection through ssh – however it seems the cvs install doesn’t allow even local pserver connections.  Finally I put all this together and thought I would share it with the world by writing a new article Adding a safe multi user subversion repository.

41 Responses to “Setting up source control on Host Monster”

  1. aufly Says:

    Firstly, thank you for the post; many a person have tried to cope with this and failed and thanks to your post I think I’ve succeeded installing svn on my Hostmonster account.

    However, I’m very new to server administration and svn as well, and I’m just not able to actually get it to start working (syncing) form my computer.
    Could you please provide some more detailed instructions on
    1. How to create a new repository
    2. How to add a new user to a repository
    3. How to set up a working local repo on that users computer (after installing tortoise svn).

    Thank you so much

  2. jon Says:

    Firstly your welcome, it was something I was sure was possible but couldn’t find any help on.

    (1) If you followed the steps for setting up subversion (or just ran the first script on the page) then near the end you’ll see there was a section as follows:

    ——-
    # now we need an svn repository
    mkdir svnrepos
    svnadmin create svnrepos –fs-type fsfs
    ——-

    This should have already created you an empty repository called “svnrepos”.

    (2) Adding users to your repository is handled by the second script on the page. In order to add a user each user (in this case you) needs to create and send to you a public ssh key. The start of the Client/user installation details this for windows for Tortoise by running puttygen. The public key can then be saved as a simple text file that you can upload to the root your Hostmonster account (alternatively you can copy it from the text box in puttygen and paste it into an open terminal window after the echo command and redirect into a text file).

    Once you’ve got that public key on the Hostmonster account adding a user is as simple as logging in via ssh and following the steps in “Registering the public keys your users send you”. I’m going to rename that as it’s not so clear.

    I’ve got to run out right now, sorry. I’ll finish this reply off later. If you get as far as logging into your repo from tortoise it’s probably worth setting up trunk/tags/branches folders before you start importing anything – google will tell you more about that.

  3. jon Says:

    OK, sorry for splitting the message in half, I’ll try to finish now!

    As I was saying once you’ve got the public ssh key uploaded to your host monster account you should be able to create a svn user with the second script on my page. At the very bottom of the page is the instructions, from a ssh terminal session run the command:

    ./create_svn_user.sh [new user name] [public key file]

    This will authenticate the public key file to access your Hostmonster account via ssh however it will also *only* allow that key to access subversion through the username you supply to the subversion repository created earlier.

    Once you’ve done that you should be ready to access the repository from within Tortoise on windows. You then need to follow the rest of the Tortoise SVN client installation instructions – I’d recommend not trying to use pagent.

    (3) To check if you’ve got it all working then you should try the tortoise repository browser. So open up a windows explorer and go to a folder you want to set up. Then right click in the empty space in the folder window and select the “Tortoise SVN” subgroup about half way down and then the top item, “Repo Browser”. This throws up a box asking for a URL. Enter the URL for your set up repository (and the tunnel you set up by editing the subversion config file). For me this is “svn+ssh-user://sharpste@sharpstep.com/”. After pressing the OK button the browser should start up pointing at your repository.

    On the left hand side there should be a folder showing the name of your svn url (the one you just entered). Under this folder it’s normal to create three sub folders, “branches”, “tags” and “trunk”. You can do this by right clicking on the parent folder and selecting “Add folder…”. Now select the trunk folder. This is where you should place all you files you want in revision control (in my case c/c++ and a bit of objective c source files along with some assets).

    The final thing you need to do is checkout your trunk folder. Checking something out in subversion (as CVS) means getting a working copy into a local folder. It doesn’t mean (as with some revision control systems) that those files are locked and only you can edit them. To checkout the trunk folder, right click on it and select “Checkout”. Check it out into the folder on your machine where you want to work.

    Once the folder is checked out when you browse to it you’ll notice it’s folder icon will have changed to have a small green circle with a tick on it over the bottom left. If you open the folder then inside you’ll see a .svn folder which will appeared ghosted. This .svn folder is where subversion stores all it’s information for the parent folder. If you delete it then you loose the source control bindings, don’t do it!

    Now you could try out using subversion. Create a file Test.txt (with notepad or similar) inside your working folder and then enter some text into it and save it. Right click on it in explorer and from the “Tortoise SVN” menu select “SVN Add”. This file is now marked to be revision controlled – however you’ve not yet made any changes on the server. To do that you need to do what is called a Commit operation.

    In explorer go to the parent folder. See how your working folder’s icon has changed and now there is a red circle with an exclamation mark over it – that means your local copy has some changes that need sending to the server. So lets try that. Right click on the folder and select “SVN Commit…”. It will then open a dialog box asking you to enter a comment for this particular set of changes. It’s a good habit to get into so enter something like “initial test”.

    Also at the bottom of the window there is a list box which should currently just show the file you’ve added with a tick next to it. This box lists all the files that have changed inside your working copy, so you can select to only commit certain ones to the server for each commit operation (and comment you add). Also later you may see that there are files in the list which aren’t ticked by default. These files are inside your working folder but you’ve not marked them to be added to the subversion repository. Still if you tick them before doing the commit operation they will be added. Also if you want to ignore them it’s possible to browse to them in the explorer and right click on them and select “Add to ignore…” from the subversion menu. Then once you commit the folder you won’t be asked about them.

    Once you’ve committed your test file, it’s probably reassuring to check that it’s really there. To do this check out your repository somewhere else on your computer just as you did the first time. This time the working folder you select should now have the text file you created pulled down off the server into it. You can have as many working copies of the same repository on a local machine as you like. I often have a couple and work on different features in each, using subversion to help me merge the changes all together.

    The other operation you really need to know about for subversion is the Update operation. This will get any changes that anyone has committed since the last time you updated (or you checked out the folder) to the subversion repository and bring them to your working folder. If you’ve been editing the same files it will also prompt you to check and fix any merge conflicts that may have occurred. This is where the real power of revision control comes in! Again with tortoise this is all done though the windows explorer context menu.

    If you want to experiment with this edit your text file in both places, commit one and then update it over the other and see what happens.

    I hope this has helped a little more. I do need to improve my tutorial and will try to incorporate some of this information as well as some screen shots and the like. Please don’t hesitate to ask if you need any more help/advise, I’ll try my best!

  4. detectedstealth Says:

    Hello I have tried to follow your tutorial, the problem I am having is, I am always prompt for my ssh (host monster’s password).

    I am using tortoise SVN.

    When trying:
    svn+ssh-user://[hostmonster-uid]@[website][path-to-repos]
    or
    svn+ssh://[hostmonster-uid]@[website][path-to-repos]

    It is always prompting me for my password, its as if it is not seeing the public/private keys.

    Any suggestions?

    [PS: If I provide my hostmonster-pass I can user the repository. However there is going to be 20 people using this so I don't want to provide my password]

  5. jon Says:

    If you followed the suggested script exactly then the path to your repository in your URL will always be ‘/’ as the tunnel you created (with the create_svn_user.sh script) redirects automatically to that repository. So the URL should be svn+ssh-user://[hostmonster-uid]@[website]/ You would expect svn+ssh://[rest of url] to ask for the password.

    My guess is that the key authentication is failing for some reason and so it’s falling back to try a normal ssh login for the svn tunnel.

    I was having similar problems whilst I was figuring this out and as I recall it was due to a problem with my configuration file for Subversion on my local (windows) machine.

    I’d check the C:\Documents and Settings\[Windows User]\Application Data\Subversion\config file where you added the TortoisePLink tunnel called ‘ssh-user’.

    Check that line – is that the path to your private key is correct. Did you replace all the backslashes (\) with forward ones (/)?

    I figured out my problem by using putty’s plink.exe instead of the TortoisePLink one (available on the putty site). It’s exactly the same program but the putty one will give you error messages whereas the tortoise one will just silently continue. You could give that a go.

    If your local machine all seems to be correct then it must be something on the server. Firstly I’d check the contents of the ~/.ssh/authorized_keys file (you should just be able to display it with cat from a terminal, if you know them vi or emacs are probably better ways to view them as they don’t wrap lines and you can move around the buffer).

    For each user you’ve added you should have a line that looks something like this:

    command=”[your home folder]/bin/bin/svnserve -t -r /[path to your repository] –tunnel-user=[svn username for key],no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty [the public key text] =svn user [svn username for key]

    It’s worth checking that your home folder contains bin/bin/svnserve and it’s executable. Quite why I unwrapped it there I don’t know! Also check the repository (the default instructions were for [your home folder]/svnrepos).

    As an aside if you want to add multiple repositories it’s possible but a different key will be needed for each (and so tunnel on the host).

    I guess the last thing to check is that it’s the public key that’s on the server and the private one that’s pointed to in the local config file.

    Please do let me know if any of that helps or I need to better explain myself, or if you’re still having problems.

  6. jon Says:

    That key file line should have read –tunnel not -tunnel, my mistake sorry.

  7. detectedstealth Says:

    Hi Jon,

    I am not sure whats going on I deleted everything and retried I even just ran the first part that downloads your script. It is still not working, I have looked over all the files and they seem to be correct.

    It is still prompting for the ssh password and when I don’t provide the path after my website.com it says it can’t find any repertories.

    Also I am using windows vista and don’t have the path: :\Documents and Settings\[Windows User]\Application Data\Subversion\config

    So when I right click on a folder I go through the Tortoise settings, then click the edit button for Subversion configuration file, in that file it is pointing to my private key, and my public key is on the server.

  8. detectedstealth Says:

    When using plink I keep getting the error: “Server refused our key”

    I looked through the keys on both my local and server and they match so I am at a loss here.

  9. jon Says:

    I think there has to be a problem with the key either on your vista machine or on the server. The server would be my guess but I’m not 100% sure. It’s clearly not accepting your key. Therefore it’s asking you for a password and the tunnel set up by the create_svn_user script that redirects to the repository isn’t working.

    I think actually I’ve just figured it out. When you use putty to save the public key it uses a different file format – entirely my mistake. In the puttygen window it shows you a ‘Public key for pasting into OpenSSH authorized_keys file”. This is what you need to register on the server with the create_svn_user script and not the contents of the file it saves with the ‘Save public key’ file. I’m really, really sorry I didn’t spot that before.

    You can edit the file it saves, removing the top two lines and the bottom line, ending the text just after the final ‘=’ of the key (so no newline). Then it will work with the authorized_keys file. Or you could generate a new key.

    I’ve just gone through the process of setting this up on vista. Which took some time as I’ve not booted vista for over 6 months so I had to update a whole host of stuff (as I was rebooting to install TortoiseSVN). The good news is that things work for me as expected. You’re right though the svn configuration file is elsewhere, thanks for letting me know about the easy way to locate and edit it.

    I’ve updated the article text and included a series of screenshots of the process I went through to setup TortoiseSVN on my Vista install.

  10. detectedstealth Says:

    Hi Jon,

    Thanks for the update, it is working perfectly now. I was pulling out my hair trying to get this to work lol.

    It was like you said a problem with the public key and using the save option.

    Once again thanks for taking the time to help with the problem I was having.

  11. jon Says:

    You’re welcome, it was my fault you had the problem, glad to have helped :-)

  12. BinaryGod Says:

    So if I understand this correctly even though users are logging into the server via ssh with my username they will NOT need my password.

    Also, if someone is just wanting read access, ie checking out only, will they still need to provide me with a key file?

  13. jon Says:

    That’s correct, they are using your username but don’t need your password. They are given ssh access via the public/private key pair which removes the need for a password. However because of the rules set up for that key pair, the only thing that can be done is access svn.

    I’ve not tried this however to provide read only access in this way you will have to provide a public/private key pairing in just the same way. However you could actually give out the same private key to anyone who you want to give read only access to. You then set up the new user for read only access in exactly the same way as before.

    There are a number of ways to make this key pair read only, however the easiest one is to edit the ~/.ssh/authorized_keys file. Here find the line for the new user (if you’ve just created it then it’s the last line). Here you can add the -R option to the svnserve options so rather than reading …svnserve -t -r ~/svnrepos… it reads …svnserve -t -r -R ~/svnrepos… If you like I can create a modified version of the create_svn_user.sh script file to support this as an option.

    Another alternative (which I’m not going to go into here at the moment) is to set up public http access to your subversion repository. That would require building and configuring svn differently and I’ve not researched this at all. If some folks express interest in this an I find the time I may have a go at this an document the process.

  14. darknessw Says:

    I’m having a little problem on linux, I just copied the generated ppk files from windows’s puttygen and edited the file /home/me/.subversion/config like this:
    [tunnels]
    wag = /usr/bin/ssh -i /home/me/ssh-svn.ppk

    It is a non-keyed ppk file generated on another PC.
    So when a I try to do a SVN CO, it is asking the passphrase for the ppk file.
    Should I create another ppk file (with a passphrase this time)?
    thanks!

    and BTW, great tutorial!

  15. jon Says:

    I think the PPK files are only for putty on windows so that’s not going to help you..

    Instead for linux it’s similar to the OSX instructions except of course you don’t configure the XCode client as it’s not on OSX. XCode uses the standard svn command line tools and you have the ssh command line tools – exactly the same command line tools exist under linux (and under cygwin too).

    So run ssh-keygen from you linux shell which will create you the private key with the filename you specify. You then get [filename] and [filename].pub files produced in your current directory. [filename] is the private key you should point your ssh tunnel at rather than /home/me/ssh-svn.ppk

    Let me know if that fixes your problem.

    And thanks for the praise, I’m glad it’s helping some folks.

  16. darknessw Says:

    dude, you’re awesome!!!!
    thank you so much!!!

  17. danieldoe Says:

    Hi, first, great tutorial!! and really nice work. Not that i have said that, im having a little problem, i follow the step by step instructions from your tutorial , but when i try to add a new svn user i get the following error:

    Cant continue svnserve dosent appear…

    My guess is that for some reason the SVN service wasnt installed correctly, or maybe i have done something wrong?? is there any extra steps i should do before trying to create a new svn user ??

    Thank you so much for your help, Daniel from Mexico.

  18. jon Says:

    Hi Daniel,

    I’m honestly lost as to why this is happening. I think I’ll need a little more information to help. Note we’re not actually running any kind of service, although it appears that way! There shouldn’t be anything extra you need to do to in order to add a user so I’ll suggest some things to check.

    Firstly that error is returned from the script I made to add a user.

    firstly from a terminal/bash session on the host try

    which svnserve

    This should return nothing.

    Then run

    echo $PATH

    this should have something like /home2/myhostmonstername/bin/bin in it – probably right at the end.

    This is where svn should have been installed.

    The following lines of the install script should have ensured this was on your path.

    ##################
    cd ~
    echo “PATH=\$PATH:\$HOME/bin/bin/” >> .bashrc
    echo “export PATH” >> .bashrc
    ##################

    If it’s not on your path try running these three lines again, then log out and back in again.

    Of course if you’re not using bash as your default shell then you’ll have to do the same thing for whatever shell you’re using. The default is bash though.

    If your path is correct then it’s most likely svn either didn’t compile or install properly. Try going through all the steps from the very first shell script by hand, my guess is that one of them will fail or report an error and we can go from there.

  19. medhad Says:

    hi john,
    First let me thank you for giving your time and effort to put up this tutorial on the web.
    Now I have been trying to set up subversion for a while in my hosting account. I was able to install subversion without much trouble following your procedures, but then got stuck in connecting through tortoise client. At that time i tried to create different repository in ‘www’ folder and tried to checkout from local client but couldn’t. however, later i have figured it out and created user public/private key and configured in my vista machine correctly. now i connect through the repo browser and even can check out create/add folders through it. But problem is i cant figure it out in which repository this folders and copies are getting updated. currently i have two repository one is my root/home1/username/svnrepos
    and another is root/home1/username/www/medhad/devrepos .. but i havent found any of the added folder in any of these directories or in the subfolders. Am I missing something? can you help me regarding this? also i want to create some of my repository in the www/ folder so that i can connect to the database and point other domain addresses to view and test my web project directly from the server!
    Thanks in advance!

  20. jon Says:

    If you are using my scripts to create the svn user i.e. add it into the authorized keys on your host then you will be using the svnrepos folder.

    The key to this is in the create_svn_user.sh batchfile around the bottom where it adds the new line to your ~/.ssh/authorized_keys file using echo. The option you are interested in is the following one which sets up the repository to use; -r ~/svnrepos. This means that is should be root/home1/username/svnrepos folder.

    As for automatically having your code appear on the server I’m not too sure of how to do this. I know that subversion can be compiled to work over http but I don’t know how or if hostmonster supports it.

    The repository doesn’t store a mirror of the latest version instead the files are all stored in a form of database. So it is not possible to simply make a linked folder or similar to allow this to be reached from your www folder.

    I think you may have to ssh into your account and get a local copy wherver you want it inside your www folder using the command line svn tools and update it in this way whenever you want it updated. A little searching on command line svn should be all you need. A single checkout will get your files. From then on you just need to change into the root folder where you checked out into and run svn update.

    You should be able to write a script to do this though and so have it being a pretty painless operation.

    cheers,
    Jon

  21. dominique Says:

    First, thanks for getting me as far as I am but I m having still a problem.
    I ve install subversion with your scripts, created a repository, I can see it created in /~/svnrepos. I ve installed tortoise and cofigured it like described. I created the private and public key. I ve created a user also using your script and the public key. The private key I loaded with pageant.
    When I try to access the repository using svn+ssh://dominiq1@dominiquedecooman.com it prompts for a password, I use my ssh pasword. It connects and then it says “no repository found in svn+ssh://dominiq1@dominiquedecooman.com”. I tried to add /svnrepos didnt work either. It seems not to find the repository but it is present on the server. I allready did some research ad I found following posts: http://svn.haxx.se/users/archive-2003-08/0826.shtml I tried to use the tunnel mode as describe -> no succes.
    I m completly stuck now and perhaps you could help me out. I m having the feeling I m very close…

  22. medhad Says:

    Thanks John.. I got your point and finally able to make it work the way I wanted to :-)
    I can create separate repository now for different projects by manually modifying the .ssh/authorized_keys file’s path location for each user. Also for testing my project directly from my hosting site all i do is just check out a working copy in the www folder where i have pointed my domain address. now whenever there is a change i just run svn up command and its ready to go :-) .. thanks again !

  23. jon Says:

    medhad: You’re welcome yup I have multiple repositories and just different keys for them. I created multiple scipts to add users to different repositories.

    dominique: Sorry for the delay. If it is asking for a password then something is not working properly. I haven’t been using pageant so you are on you’re own there I’m afraid but it sounds like you’re not getting the key used automatically for the ssh session. I’m completely unfamiliar with pageant so don’t know how to bind it to always use the same key for the same target.

    However we also only want it to use that key for subversion access. If it were used it for all ssh access then you would no longer be able to ssh in as that key is locked to only allow subversion access to the host. I don’t know if that is possible with pageant either although suspect it should be.

    The article you found is and your thoughts on tunneling are correct. The user creation script you used on the server will already have set up the server side tunnel with the ‘svnserve -t -r …’ section in the authorized_keys file.

    So I’d suggest that rather than attempting to use pageant try the tunneling method described in the article by editing the svn configuration and adding specific new tunnels. This way each specific tunnel mode can be bound to a different private key so you can have multiple repositorys also (as medhad has done).

    This tunneling method is already setting up the repository root for you so the url you can enter into tortoise repository browser should be “svn+ssh-user://dominiq1@dominiquedecooman.com/” assuming you set the tunnel name up to be ssh-user in the svn config file. If this is still not working make sure you have replaced all the back slashes (\) with forwards ones (/) in the path to the key and there is nothing on the tunnel line after the closing quotation mark surrounding that path.

    The other thing to troubleshoot is that the public key you used on the server is correct. It needs to be copy-pasted from the box in puttygen not the one saved out from puttygen.

  24. HardStyle Says:

    Hi jon!
    I was curious to know, What happens if I make a mistake? Is there a way to revert back? What kind of backups can I do so I am able to restore if i make a mistake?
    Thanks for everything :)

  25. HardStyle Says:

    I managed to get it installed, but im wanting to setup the repo on redmine aswell..
    I have for the repo URL: svn+ssh://username@domain.com
    but nuthing is coming up. Do i have to setup a private/public pair key for the server to connect? If so, would you know how?

    Thanks

  26. jon Says:

    Hi HardStyle,

    I’m glad you have it working! I don’t think you could have done a lot of damage, however backups are always a good idea… I didn’t manage to break anything when I figured this out using trial and error.

    As for redmine, I’d never heard of it until just now but it looks pretty cool… maye if I find time I’ll have a play with it.

    Do you set up Redmine to access the account as per a normal user? If so then it will need a kay pair to access it. Quite how you give it a private key to work from I don’t know, my guess is it would not want one generated from putty-keygen and insted an open ssh one, which you could generate on your hostmoneter accound via the ssh-keygen command if logged in I think.

    Is redmine running on the same account as your svn host is? If so you may be able to set it up to access the subversion repository locally too. Without installing it myself I’m not sure I can help much more.

    let me know if you succeed, it does look very interesting.

    cheers,
    Jon

  27. HardStyle Says:

    Hey i managed to get it working with redmine =)
    Instead of just entering svn+ssh://user@domain.com
    I used the full URL to the repository
    svn+ssh://user@domain.com/home//svnrepos

    And then for redmine to populate the repo with all the changesets, in SSH i ran in the redmine directory;
    ruby script/runner “Repository.fetch_changesets” -e production;

    and voila! =D
    Thanks for everything jon!

  28. HardStyle Says:

    appearrs to be a syntax issue with wordpress..
    svn+ssh://user@domain.com/home//svnrepos
    was meant to be
    svn+ssh://user@domain.com/home/ user account /svnrepos

  29. jon Says:

    Awsome, good work HardStyle! I wish I had time to investigate a similar solution…

  30. bimal Says:

    Hay man good work I have installed it and client is also working fine.

    Thanks for everything jon!

  31. darthdeus Says:

    Hey, awesome job, I’ve managed to get it working, but …
    it took me 2.5 hours to figure out one little stupid thing

    in http://sharpstep.com/Articles/HostMonster-svn/v1.0/index.html
    you have following line

    Add the following line below it:
    ssh-user = “C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe” -noagent -i “[path to the private key just generated]“.

    Notice the dot (.) after the [path to the private key just generated]” … it took me 2.5 hours to find that little fucker after just stupid copy & paste :)

    I just found it when I was asking for help and I copied it out from the config file and then noticed “hey, whats that dot doing there?!?” :)

    anyway, thanks very much, awesome job!

  32. jon Says:

    That seems odd.

    I assume that both svn and svnadmin return “xxxx: command not found”. Or do you have svn but not the svnadmin command installed?

    Try “which svn” and “which svnadmin”

    I get “/home2/sharpste/bin/bin/svn” for both which lines up with your experience for where they should be installed. However, you do not seem to have them there… I wonder if they have been placed somewhere else for some reason…

    Try doing ls “bin” and ls “bin/bin”. Perhaps they built to bin rather than bin/bin (I wasn’t sure why that happened for me).

    Another option is, from your home directory try “find . | grep svn”
    That will search from your home directory and list any file names containing “svn”. If you find the commands, set them up in the path.

    Do let me know how it goes.

  33. jon Says:

    Hi shuthichi, sorry for the long delay, life caught up with me.

    I’ve seen your problem I think. You modified the script to download and unzip different versions of subversion and apr, however they do not appear to be being built, nor does apr appear to be being downloaded to the correct place.

    In the script you need to change the line “cd subversion-1.5.4″ to something else such as “cd subversion-1.6.5″ I suspect. similarly the “mv apr-1.3.3 apr” will also need to also be changed to “mv apr-1.3.9 apr”. finally the lines at the end of the script which remove the source code should also be modified to remove the source you just compiled.

    However, as I’ve not built with the version you are trying I do not know if any other problems may occur with the new code base, hopefully not but do let me know if you have a problem configuring or compiling it (the “./configure”, “make” and “make install” lines do the compilation).

    If you re-run the script after fixing it then remove the 3 lines that modify .bashrc from it as you do not need to keep modifying that file (however after the comment keep the “cd” ~ line.

    let me know how you get on.

    Jon

  34. penguineer Says:

    Thanks very much for the tutorial and for all of the support you give along the way.

    I used your help extensively for my setup of Subversion and Redmine on Hostmonster and things worked very well with just a bit of tweaking, apparently due to changes over time.

    I am having an issue that perhaps you can help with that I don’t see mentioned here. When I connect via TortiseSVN, I am required to enter the key passphrase over and over as I navigate the repository. The Subversion manual says this will happen under the section on svn+ssh. It suggests a workaround of using a separate SSH password caching utility (SSH-agent on *nix, pageant on Windows).

    Your material doesn’t seem to suggest that this should be necessary. Does your setup require repeated login? If so, how do you deal with it?

  35. jon Says:

    Sorry Penguineer, I haven’t set key passphrases and so didn’t have that issue. I’m pretty sure pageant should be able to solve it for you though.

  36. nertim Says:

    Hi Jon,

    You have done a great job in setting up this tutorial. Following is my setup:

    hostmonster account – Where I have setup my repository
    my laptop (client machine) + my home PC (client machine) both of which run Ubuntu.

    I was able to follow your instructions and setup subversion and create the svnrepos directory in $HOME. I seem to be having issues connecting to the svnrepos directory from my client machines.

    I also had to manually create .ssh folder on my server and .ssh/authorized_keys files on my server. I am not sure if that is normal or not.

    I used ssh-keygen -t rsa on my laptop to generate a private/public keys which I copied to my server. On my server I ran ./create_svn_user.sh username privatekey, which seemed to run successfully.

    Now on my laptop I have a Webprojects folder, so I ran following command svn import -m “Web Project” svn+ssh://username@www.domain.com, which prompts me for a password. When I use the password I used to generate the private key file, it does not work.

    What am I doing wrong? Any help would be greatly appreciated.

  37. jon Says:

    Hi Nertim,

    What happens if you enter your hostmonster password? I think it will work give a different error.

    However, you have the wrong url. It should be svn+ssh-user://username@domain.com. The important part is for the custom ssh tunnel you created on the client.

    Note that I don’t use the www prefix for the hostmonster site, I don’t know if that matters.

    On a linux box you still need to create the custom tunnel to associate the key with the server account. To do so is similar for osx (or windows for that matter). On the client you need to edit the ~/.subversion/config First, ensure there is one of those files, by running ssh -help. No do a directory listing in the home folder (cd ~; ls -a) there should be a .subversion folder. If there is no .subversion folder perhaps it’s called .ssh, it’s a long time since I did this on linux.

    Next edit that file, it’s a text file, so your favourite text editor will do, I like emacs, if you’re not sure use gedit (gedit ~/.subversion/.config). Now follow the instructions for the OSX client setup following from find the [tunnels] section.

    Rather than using XCode of course you want to go back to using the svn command line. Or use a frindly svn front end for ubuntu (I think rapidsvn will work amongst others (I’ve had it work, along with using the eclipse ide – check out the package manager). Just use the url svn+ssh-user://blah.

    I’d suggest that you start with a test files rather than a real project a plain text file will do and see if you can import and pull it from one of your clients to the other.

    Let me know if that helps.

    cheers,
    Jon

  38. nertim Says:

    Hi Jon,

    Thank you sooooo much for your advice. Just so that I understand correctly, I should be setting up the ssh tunnel on each client from which I wish to update my repository.

    Following is the command I was able to use to connect to my repository…
    svn co svn+ssh-mitren://cmreposi@cmrepository.com/home2/cmreposi/svnrepos/
    running this command prompts me for the cmreposi password rather than the passphrase set in the subversion_mitren file… how can I resolve this issue? I was hoping to not give out the cmreposi password to the rest of the team.

    thanks.

  39. nertim Says:

    I was able to figure out this issue. I had the private key on both my client machine and server.. once I replaced the server key with the public key it fixed the password issue.

  40. TheBeege Says:

    Hey jon,

    Your article was great for getting things setup, though I’m having issues connecting to SVN.

    I created the .ssh folder in home and created the authorized_keys file. I was getting errors trying to run your create_svn_user script, so I executed the echo statement manually into the authorized_keys file.

    I’m very new to this stuff, so please bear with me. I created several SVN repositories, one for each project (is this wrong? is there a better practice way?). Using a public key I generated as an example, I replaced the second path in the echo command with the path of one of these SVN repos and used my public key and all that jazz.

    After editing my local SVN config file with my private key and attempting to connect using TortoiseSVN, I realized that maybe my repos need to be in my public_html folder. I moved all the repos there, modified the path in my authorized_keys file accordingly, and still no luck. It still repeatedly prompts me to input a password.

    If I attempt to connect using the root login, I can only access the site root (though it shows no files), and Putty produces a fatal error stating the connection was refused.

    I’ve spent far too many hours on this with no results. Any assistance would be greatly appreciated.

    Thanks

  41. jon Says:

    Hi, sorry I didn’t mean to ignore your post, I missed the notification.

    If you have different projects you want to give different folks access to you can create a different repository for each project. Or you can use SVN to allow access to different projects within the single repository. I’m sure there is a right answer to your question, however, I don’t know what it is. Whatever works best for you I guess!

    The repository should not need to be in the public_html folder, mine isn’t. The idea is that rather than connect with html your users will connect via ssh.

    If you login as root and give the root password you should be able to use the usual svn+ssh tunnel and so create and modify files via subversion. However, the point of the keys is that you don’t have to give a password, instead it creates a specific tunnel per key.

    What you are saying suggests to me that you are not creating the correct content in the authorized_keys file, however, this is a guess. What errors do you get running the script?

    regards,
    Jon

Leave a Reply

You must be logged in to post a comment.