doc/manual.docbook
changeset 122 05b676684c7e
parent 121 62185dc7d0c9
child 123 20b54500a618
equal deleted inserted replaced
121:62185dc7d0c9 122:05b676684c7e
    67 repository.
    67 repository.
    68 </para>
    68 </para>
    69 <section>
    69 <section>
    70 <title>Creating a repository host</title>
    70 <title>Creating a repository host</title>
    71 <para>
    71 <para>
    72 In what follows, we assume that you usually sit at a machine called
    72 In what follows, we assume that your username is <systemitem
       
    73 class="username">jay</systemitem>, that you usually sit at a machine called
    73 <systemitem class="systemname">my-workstation</systemitem> and you wish to
    74 <systemitem class="systemname">my-workstation</systemitem> and you wish to
    74 install mercurial-server on <systemitem
    75 install mercurial-server on <systemitem
    75 class="systemname">repository-host</systemitem>. First, you'll need to
    76 class="systemname">repository-host</systemitem>. First, you'll need to
    76 create an SSH public key if you haven't already. You should consult your
    77 create an SSH public key if you haven't already. You should consult your
    77 system documentation on how to do this, but it should look something like
    78 system documentation on how to do this, but it should look something like
    78 this.
    79 this.
    79 </para>
    80 </para>
    80 <screen>
    81 <screen>
    81 <computeroutput>user@my-workstation:~$ </computeroutput><userinput>ssh-keygen</userinput>
    82 <computeroutput>jay@my-workstation:~$ </computeroutput><userinput>ssh-keygen</userinput>
    82 <computeroutput>Generating public/private rsa key pair.
    83 <computeroutput>Generating public/private rsa key pair.
    83 Enter passphrase (empty for no passphrase): 
    84 Enter passphrase (empty for no passphrase): 
    84 Enter same passphrase again: 
    85 Enter same passphrase again: 
    85 Your identification has been saved in /home/user/.ssh/id_rsa.
    86 Your identification has been saved in /home/jay/.ssh/id_rsa.
    86 Your public key has been saved in /home/user/.ssh/id_rsa.pub.
    87 Your public key has been saved in /home/jay/.ssh/id_rsa.pub.
    87 The key fingerprint is:
    88 The key fingerprint is:
    88 8b:aa:0a:98:fe:e7:84:48:a3:fe:5f:31:4b:16:e6:0b user@my-workstation
    89 8b:aa:0a:98:fe:e7:84:48:a3:fe:5f:31:4b:16:e6:0b jay@my-workstation
    89 user@my-workstation:~$ </computeroutput><userinput>ssh-add</userinput>
    90 jay@my-workstation:~$ </computeroutput><userinput>ssh-add</userinput>
    90 <computeroutput>Enter passphrase for /home/user/.ssh/id_rsa: 
    91 <computeroutput>Enter passphrase for /home/jay/.ssh/id_rsa: 
    91 Identity added: /home/user/.ssh/id_rsa (/home/user/.ssh/id_rsa)
    92 Identity added: /home/jay/.ssh/id_rsa (/home/jay/.ssh/id_rsa)
    92 user@my-workstation:~$ </computeroutput></screen>
    93 jay@my-workstation:~$ </computeroutput></screen>
    93 <para>Now copy the files you're going to need over to your target system, and install mercurial-server</para>
    94 <para>Now copy the files you're going to need over to your target system, and install mercurial-server</para>
    94 <screen>
    95 <screen>
    95 <computeroutput>user@my-workstation:~$ </computeroutput><userinput>ssh-copy-id repository-host</userinput>
    96 <computeroutput>jay@my-workstation:~$ </computeroutput><userinput>ssh-copy-id repository-host</userinput>
    96 <computeroutput>user@repository-host's password:
    97 <computeroutput>jay@repository-host's password:
    97 Now try logging into the machine, with "ssh 'repository-host'", and check in:
    98 Now try logging into the machine, with "ssh 'repository-host'", and check in:
    98 
    99 
    99   .ssh/authorized_keys
   100   .ssh/authorized_keys
   100 
   101 
   101 to make sure we haven't added extra keys that you weren't expecting.
   102 to make sure we haven't added extra keys that you weren't expecting.
   102 user@my-workstation:~$ </computeroutput><userinput>scp mercurial-server_0.6.1_amd64.deb repository-host:</userinput>
   103 jay@my-workstation:~$ </computeroutput><userinput>scp mercurial-server_0.6.1_amd64.deb repository-host:</userinput>
   103 <computeroutput>mercurial-server_0.6.1_amd64.deb 100%
   104 <computeroutput>mercurial-server_0.6.1_amd64.deb 100%
   104 user@my-workstation:~$ </computeroutput><userinput>ssh -A repository-host</userinput>
   105 jay@my-workstation:~$ </computeroutput><userinput>ssh -A repository-host</userinput>
   105 <computeroutput>user@repository-host:~$ </computeroutput><userinput>sudo dpkg -i ../mercurial-server_0.6.1_amd64.deb</userinput>
   106 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>sudo dpkg -i ../mercurial-server_0.6.1_amd64.deb</userinput>
   106 <computeroutput>[sudo] password for user: 
   107 <computeroutput>[sudo] password for jay: 
   107 Selecting previously deselected package mercurial-server.
   108 Selecting previously deselected package mercurial-server.
   108 (Reading database ... 144805 files and directories currently installed.)
   109 (Reading database ... 144805 files and directories currently installed.)
   109 Unpacking mercurial-server (from .../mercurial-server_0.6.1_amd64.deb) ...
   110 Unpacking mercurial-server (from .../mercurial-server_0.6.1_amd64.deb) ...
   110 Setting up mercurial-server (0.6.1) ...
   111 Setting up mercurial-server (0.6.1) ...
   111 user@repository-host:~$ </computeroutput></screen>
   112 jay@repository-host:~$ </computeroutput></screen>
   112 <para>
   113 <para>
   113 mercurial-server is now installed on the repository host.  Next, we need to give you permission to access its repositories.
   114 mercurial-server is now installed on the repository host.  Next, we need to give you permission to access its repositories.
   114 </para>
   115 </para>
   115 <screen>
   116 <screen>
   116 <computeroutput>user@repository-host:~$ </computeroutput><userinput>ssh-add -L > my-key</userinput>
   117 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>ssh-add -L > my-key</userinput>
   117 <computeroutput>user@repository-host:~$ </computeroutput><userinput>sudo mkdir -p /etc/mercurial-server/keys/root/user</userinput>
   118 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>sudo mkdir -p /etc/mercurial-server/keys/root/jay</userinput>
   118 <computeroutput>user@repository-host:~$ </computeroutput><userinput>sudo cp my-key /etc/mercurial-server/keys/root/user/my-workstation</userinput>
   119 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>sudo cp my-key /etc/mercurial-server/keys/root/jay/my-workstation</userinput>
   119 <computeroutput>user@repository-host:~$ </computeroutput><userinput>sudo -u hg /usr/share/mercurial-server/refresh-auth</userinput>
   120 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>sudo -u hg /usr/share/mercurial-server/refresh-auth</userinput>
   120 <computeroutput>user@repository-host:~$ </computeroutput><userinput>exit</userinput>
   121 <computeroutput>jay@repository-host:~$ </computeroutput><userinput>exit</userinput>
   121 <computeroutput>Connection to shell closed.
   122 <computeroutput>Connection to shell closed.
   122 user@my-workstation:~$ </computeroutput></screen>
   123 jay@my-workstation:~$ </computeroutput></screen>
   123 <para>
   124 <para>
   124 You can now create repositories on the remote machine and have complete
   125 You can now create repositories on the remote machine and have complete
   125 read-write access to all of them; you need never log on to <systemitem
   126 read-write access to all of them; you need never log on to <systemitem
   126 class="systemname">repository-host</systemitem> again.
   127 class="systemname">repository-host</systemitem> again.
   127 </para>
   128 </para>
   128 </section>
   129 </section>
   129 <section>
   130 <section>
   130 <title>Creating repositories</title>
   131 <title>Creating repositories</title>
   131 <screen>
   132 <screen>
   132 <computeroutput>user@my-workstation:~$ </computeroutput><userinput>cd my-mercurial-project</userinput>
   133 <computeroutput>jay@my-workstation:~$ </computeroutput><userinput>cd my-mercurial-project</userinput>
   133 <computeroutput>user@my-workstation:~/my-mercurial-project$ </computeroutput><userinput>hg clone . ssh://hg@repository-host/repository/name</userinput>
   134 <computeroutput>jay@my-workstation:~/my-mercurial-project$ </computeroutput><userinput>hg clone . ssh://hg@repository-host/repository/name</userinput>
   134 <computeroutput>searching for changes
   135 <computeroutput>searching for changes
   135 remote: adding changesets
   136 remote: adding changesets
   136 remote: adding manifests
   137 remote: adding manifests
   137 remote: adding file changes
   138 remote: adding file changes
   138 remote: added 119 changesets with 284 changes to 61 files
   139 remote: added 119 changesets with 284 changes to 61 files
   139 user@my-workstation:~/my-mercurial-project$ </computeroutput><userinput>hg pull ssh://hg@repository-host/repository/name</userinput>
   140 jay@my-workstation:~/my-mercurial-project$ </computeroutput><userinput>hg pull ssh://hg@repository-host/repository/name</userinput>
   140 <computeroutput>pulling from ssh://hg@repository-host/repository/name
   141 <computeroutput>pulling from ssh://hg@repository-host/repository/name
   141 searching for changes
   142 searching for changes
   142 no changes found
   143 no changes found
   143 user@my-workstation:~/my-mercurial-project$ </computeroutput></screen>
   144 jay@my-workstation:~/my-mercurial-project$ </computeroutput></screen>
   144 </section>
   145 </section>
   145 <section>
   146 <section>
   146 <title>Adding other users</title>
   147 <title>Adding other users</title>
   147 <para>
   148 <para>
   148 As things stand, no-one but you has any access to any repositories you
   149 As things stand, no-one but you has any access to any repositories you
   154 class='directory'>/etc/mercurial-server/keys</filename>, and re-running
   155 class='directory'>/etc/mercurial-server/keys</filename>, and re-running
   155 <userinput>sudo -u hg /usr/share/mercurial-server/refresh-auth</userinput>.
   156 <userinput>sudo -u hg /usr/share/mercurial-server/refresh-auth</userinput>.
   156 However, there's a more convenient way.
   157 However, there's a more convenient way.
   157 </para>
   158 </para>
   158 <screen>
   159 <screen>
   159 <computeroutput>user@my-workstation:~/my-mercurial-project$ </computeroutput><userinput>cd ..</userinput>
   160 <computeroutput>jay@my-workstation:~/my-mercurial-project$ </computeroutput><userinput>cd ..</userinput>
   160 <computeroutput>user@my-workstation:~$ </computeroutput><userinput>hg clone ssh://hg@repository-host/hgadmin</userinput>
   161 <computeroutput>jay@my-workstation:~$ </computeroutput><userinput>hg clone ssh://hg@repository-host/hgadmin</userinput>
   161 <computeroutput>destination directory: hgadmin
   162 <computeroutput>destination directory: hgadmin
   162 no changes found
   163 no changes found
   163 updating working directory
   164 updating working directory
   164 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   165 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   165 user@my-workstation:~$ </computeroutput><userinput>cd hgadmin</userinput>
   166 jay@my-workstation:~$ </computeroutput><userinput>cd hgadmin</userinput>
   166 <computeroutput>user@my-workstation:~/hgadmin$ </computeroutput><userinput>mkdir -p keys/users/other-user</userinput>
   167 <computeroutput>jay@my-workstation:~/hgadmin$ </computeroutput><userinput>mkdir -p keys/users/pat</userinput>
   167 <computeroutput>user@my-workstation:~/hgadmin$ </computeroutput><userinput>cp ~/other-users-key.pub keys/users/other-user/their-workstation</userinput>
   168 <computeroutput>jay@my-workstation:~/hgadmin$ </computeroutput><userinput>cp ~/other-users-key.pub keys/users/pat/their-workstation</userinput>
   168 <computeroutput>user@my-workstation:~/hgadmin$ </computeroutput><userinput>hg add</userinput>
   169 <computeroutput>jay@my-workstation:~/hgadmin$ </computeroutput><userinput>hg add</userinput>
   169 <computeroutput>adding keys/users/other-user/their-workstation
   170 <computeroutput>adding keys/users/pat/their-workstation
   170 user@my-workstation:~/hgadmin$ </computeroutput><userinput>hg commit -m "Add other user"</userinput>
   171 jay@my-workstation:~/hgadmin$ </computeroutput><userinput>hg commit -m "Add other jay"</userinput>
   171 <computeroutput>user@my-workstation:~/hgadmin$ </computeroutput><userinput>hg push</userinput>
   172 <computeroutput>jay@my-workstation:~/hgadmin$ </computeroutput><userinput>hg push</userinput>
   172 <computeroutput>pushing to ssh://hg@repository-host/hgadmin
   173 <computeroutput>pushing to ssh://hg@repository-host/hgadmin
   173 searching for changes
   174 searching for changes
   174 remote: adding changesets
   175 remote: adding changesets
   175 remote: adding manifests
   176 remote: adding manifests
   176 remote: adding file changes
   177 remote: adding file changes
   177 remote: added 1 changesets with 1 changes to 1 files
   178 remote: added 1 changesets with 1 changes to 1 files
   178 user@my-workstation:~/hgadmin$ </computeroutput></screen>
   179 jay@my-workstation:~/hgadmin$ </computeroutput></screen>
   179 <para>
   180 <para>
   180 The new user can now read and write to your
   181 The new user can now read and write to your
   181 <literal>ssh://hg@repository-host/repository/name</literal> repository.
   182 <literal>ssh://hg@repository-host/repository/name</literal> repository.
   182 Most other changes to access control can be made simply by making and
   183 Most other changes to access control can be made simply by making and
   183 pushing changes to <literal>hgadmin</literal>, and you can use Mercurial to
   184 pushing changes to <literal>hgadmin</literal>, and you can use Mercurial to