We all usually have multiple work machines. A personal laptop, an employer provided desktop and laptop, a client provided desktop and/or laptop. We also want to share our work across these machines. However doing that without using version control is a risk as a goof up will be expensive both in terms of time and effort. In order to share and control the changes to your work content systematically, you can use Mercurial. Obviously that implies you need a remote machine where you host your mercurial repositories that you can then access from your different machines. It is also important at the same time that you be able to decide who can access these repositories and from which machines. Mercurial provides these options to publish a repository. Of these I found SharedSSH to be the one that meets such needs as creating multiple repositories, and allowing multiple users with fine grained access. Again mercurial-server is a good enough option to implement shared ssh. Thus if you decide to host multiple repositories on a remote machine and access them with SSH, here are the steps you can follow to achieve this. Create an administrator account on UbuntuJust use the adduser command to add the admin user. Do not forget to add this user to sudoers list. Ensure that the admin user name is same as the account on your machine. Choose a machine that you own. For example, my primary machine is a Mac. So if ’jay’ is the user account that I use on Mac, ’jay’ is the admin user account that I will create on Ubuntu. You can find the details to add user here and to add user to sudoers list here. Install mercurial and mercurial-serverMercurial-Server’s deb package is available only on Lucid. So if you are on an older Ubuntu server, add the repository to your sources list. Then install Mercurial, Mercurial-Server. You can find the details here. Also install mercurial on your client. You can download the binaries for mercurial based on your client OS from here. Accessing from Mac OS X 10.6Mac comes bundled with the ssh utility. You can use the terminal to create a private/public key pair for the admin user you created earlier. Export the public key for this user to Mercurial-Server so that mercurial-server knows that this is the admin/root user for managing repositories. You can find all the details of creating ssh keys here and adding it as root/admin to mercurial-server here. With this step, you as administrator will be able to create, read, write to multiple repositories hosted on Ubuntu from your Mac client machine. Now we are left with updating the configuration so that you can access these repositories from your other work machines. Say you have a client provided Mac laptop from which you need to access these remote shared repositories. Adding another userOn the client provided Mac laptop, use the ssh utility to generate a private public key pair. Now share this public key so that it is available on your machine that you use as administrator machine. Login with the admin account on your client admin machine, use the ’hgadmin’ mercurial-server provided mercurial repository to add the client provided Mac laptop user. Now you can access the remote repositories from the client machine as well! All details to add user can be found here and to manage access rights here. Problem with hgadminI faced this problem with hgadmin. I do not know if my installation was not perfect. However the hgadmin repository was not having the .hg folder. As such when I tried to clone it, I got a repository not found error. I fixed this as follows: Delete the hgadmin folder from /etc/mercurial-server/repos on the host. On my adminstrator machine, I created a hgadmin dir, initialized it as a mercurial repository and cloned it back to the remote host. Then I followed the steps to add user as described in mercurial-server documentation. All was working then! SummarySo to summarize the steps are:
0 Comments
|
MeI am a 3D graphics software engineer. Archives
December 2011
Categories
All
|