Moxie
2015-11-23 67834872ddd5630b9c30c53c2972f5dcbf3dd5aa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- Begin Header -->
<title>Gitblit</title>
<meta charset="utf-8">
<meta name="ROBOTS" content="INDEX">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
        
<link rel="stylesheet" href="./bootstrap/css/bootstrap.css">
<link rel='shortcut icon' type='image/png' href='./gitblt-favicon.png' />
<link rel="stylesheet" href="./prettify/prettify.css" />
<!-- Google Plus Profile Page -->
<link rel="publisher" href="https://plus.google.com/114464678392593421684" />
<style type="text/css"> a.gpluspage { margin-top:3px;text-decoration: none; } </style>
 
<!-- Google Plus One -->
<link rel="canonical" href="http://gitblit.com" />
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<style type="text/css"> div.gplusone { margin-top:12px; } </style>
 
<script src="./prettify/prettify.js"></script>
<script src="./bootstrap/js/jquery.js"></script>
<script src="./bootstrap/js/bootstrap.min.js"></script>
</head>
<body onload='prettyPrint()'>        <!-- Navigation Bar -->
        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container">
                      <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                      </a>
                      <a class="brand" href="./"><img src="./gitblt_25_white.png" alt="Gitblit"></img></a>
                    <div class="nav-collapse">
                        <ul class="nav">
                            <li class='dropdown'> <!-- Menu -->
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>about<b class='caret'></b></a>
<ul class='dropdown-menu'>
<li><a href='index.html'>overview</a></li>
<li><a href='features.html'>features</a></li>
<li><a href='screenshots.html'>screenshots</a></li>
</ul></li> <!-- End Menu -->
<li class='dropdown'> <!-- Menu -->
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>documentation<b class='caret'></b></a>
<ul class='dropdown-menu'>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Gitblit GO</a>
<ul class='dropdown-menu'>
<li><a href='setup_go.html'>setup GO</a></li>
<li><a href='upgrade_go.html'>upgrade GO</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Gitblit WAR</a>
<ul class='dropdown-menu'>
<li><a href='setup_war.html'>setup WAR</a></li>
<li><a href='upgrade_war.html'>upgrade WAR</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Server Configuration</a>
<ul class='dropdown-menu'>
<li><a href='administration.html'>administration</a></li>
<li><a href='setup_authentication.html'>authentication</a></li>
<li><a href='setup_hooks.html'>push hooks</a></li>
<li><a href='setup_lucene.html'>lucene indexing</a></li>
<li><a href='setup_proxy.html'>reverse proxies</a></li>
<li><a href='setup_clientmenus.html'>client app menus</a></li>
<li><a href='setup_bugtraq.html'>bugtraq</a></li>
<li><a href='setup_mirrors.html'>mirrors</a></li>
<li><a href='setup_scaling.html'>scaling</a></li>
<li><a href='setup_fail2ban.html'>fail2ban</a></li>
<li class='divider'></li>
<li><a href='setup_viewer.html'>Gitblit as a viewer</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Client Usage</a>
<ul class='dropdown-menu'>
<li><a href='setup_transport_http.html'>using HTTP/HTTPS</a></li>
<li><a href='setup_transport_ssh.html'>using SSH</a></li>
<li><a href='eclipse_plugin.html'>using the Eclipse plugin</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Tickets</a>
<ul class='dropdown-menu'>
<li><a href='tickets_overview.html'>overview</a></li>
<li><a href='tickets_using.html'>using</a></li>
<li><a href='tickets_barnum.html'>barnum</a></li>
<li><a href='tickets_setup.html'>setup</a></li>
<li><a href='tickets_replication.html'>replication & advanced administration</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li class='dropdown-submenu'> <!-- Submenu -->
<a tabindex='-1' href='#'>Plugins</a>
<ul class='dropdown-menu'>
<li><a href='plugins_overview.html'>overview</a></li>
<li><a href='plugins_extensions.html'>extension points</a></li>
</ul></li> <!-- End Submenu -->
<li class='divider'></li>
<li><a href='federation.html'>federation</a></li>
<li class='divider'></li>
<li><a href='properties.html'>settings</a></li>
<li><a href='faq.html'>faq</a></li>
<li class='divider'></li>
<li><a href='design.html'>design</a></li>
<li><a href='rpc.html'>rpc</a></li>
</ul></li> <!-- End Menu -->
<li class='dropdown'> <!-- Menu -->
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>releases<b class='caret'></b></a>
<ul class='dropdown-menu'>
<li><a href='releasenotes.html'>release notes</a></li>
<li><a href='releases.html'>release history</a></li>
</ul></li> <!-- End Menu -->
<li class='dropdown'> <!-- Menu -->
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>downloads<b class='caret'></b></a>
<ul class='dropdown-menu'>
<li><a href='http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.zip'>Gitblit GO (Windows)</a></li>
<li><a href='http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.tar.gz'>Gitblit GO (Linux/OSX)</a></li>
<li><a href='http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.war'>Gitblit WAR</a></li>
<li class='divider'></li>
<li><a href='https://registry.hub.docker.com/u/jmoger/gitblit/'>Gitblit GO (Docker)</a></li>
<li class='divider'></li>
<li><a href='http://plugins.gitblit.com'>Plugins Registry</a></li>
<li class='divider'></li>
<li><a href='http://dl.bintray.com/gitblit/releases/manager-1.7.1.zip'>Gitblit Manager</a></li>
<li><a href='http://dl.bintray.com/gitblit/releases/fedclient-1.7.1.zip'>Federation Client</a></li>
<li class='divider'></li>
<li><a href='http://dl.bintray.com/gitblit/releases/gbapi-1.7.1.zip'>API Library</a></li>
<li class='divider'></li>
<li><a href='https://bintray.com/gitblit/releases/gitblit'>Bintray (1.4.0+)</a></li>
<li><a href='https://code.google.com/p/gitblit/downloads/list?can=1'>GoogleCode (pre-1.4.0)</a></li>
<li class='divider'></li>
<li><a href='http://gitblit.github.io/gitblit-maven'>Maven Repository</a></li>
</ul></li> <!-- End Menu -->
<li class='dropdown'> <!-- Menu -->
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>links<b class='caret'></b></a>
<ul class='dropdown-menu'>
<li><a href='https://dev.gitblit.com'>dev.gitblit.com (self-hosted)</a></li>
<li class='divider'></li>
<li><a href='http://plugins.gitblit.com'>Plugins Registry</a></li>
<li class='divider'></li>
<li><a href='https://github.com/gitblit/gitblit'>Github</a></li>
<li><a href='https://github.com/gitblit/gitblit'>Issues</a></li>
<li><a href='http://groups.google.com/group/gitblit'>Discussion</a></li>
<li><a href='https://twitter.com/gitblit'>Twitter</a></li>
<li><a href='http://www.ohloh.net/p/gitblit'>Ohloh</a></li>
<li class='divider'></li>
<li><a href='https://vimeo.com/86164723'>Gitblit Tickets screencast</a></li>
<li><a href='https://asciinema.org/a/9342'>Gitblit SSH and Plugin Management asciicast</a></li>
<li><a href='http://episodes.gitminutes.com/2014/05/gitminutes-29-james-moger-on-gitblit.html'>GitMinutes #29: James Moger on Gitblit</a></li>
<li class='divider'></li>
<li><a href='https://twitter.com/JamesMoger'>@JamesMoger</a></li>
</ul></li> <!-- End Menu -->
<li class='divider-vertical'></li>
<li><a href='https://plus.google.com/114464678392593421684?prsrc=3' class='gpluspage'><img src='https://ssl.gstatic.com/images/icons/gplus-16.png' width='16' height='16 style='order: 0;'/></a></li><li><div class='gplusone'><g:plusone size='small' href='http://gitblit.com'></g:plusone></div></li>
                        </ul>
                    </div><!--/.nav-collapse -->
                </div>
            </div>
        </div><!-- end Navigation Bar -->
<div class='container'>
<!-- Begin Markdown -->
<h2 class="section" id='H1'><a href="#H1" class="sectionlink"><i class="icon-share-alt"> </i></a>Using the SSH transport</h2><p><em>SINCE 1.5.0</em></p><p>The SSH transport is a very exciting improvement to Gitblit. Aside from offering a simple password-less, public key workflow the SSH transport also allows exposes a new approach to interacting with Gitblit: SSH commands. The Gerrit and Android projects have to be thanked for providing great base SSH code that Gitblit has integrated.</p><p>You may watch an Asciinema screencast of using the SSH transport and it's command infrastructure <a href="https://asciinema.org/a/9342">here</a>.</p>
<h3 class="section" id='H2'><a href="#H2" class="sectionlink"><i class="icon-share-alt"> </i></a>Cloning & Pushing</h3><p>By default, Gitblit serves the SSH transport on port 29418, which is the same as Gerrit. Why was 29418 chosen? It's likely because it resembles the IANA port assigned to the git protocol (9418).</p><p>Gitblit will authenticate using username/password or public keys.</p>
<pre><code>git clone ssh://&lt;username&gt;@&lt;hostname&gt;:29418/myrepository.git
</code></pre>
<h3 class="section" id='H3'><a href="#H3" class="sectionlink"><i class="icon-share-alt"> </i></a>Setting up your account to use public key authentication</h3><p>Public key authentication allows you to operate in a password-less workflow and to separate your web login credentials from your git credentials. Setting up public key authentication is very simple. If you are working on Windows you'll need to install <a href="http://git-scm.com/download/win">Git for Windows</a>.</p><p>First you'll need to create an SSH key pair, if you don't already have one or if you want to generate a new, separate key.</p>
<pre><code>ssh-keygen
</code></pre><p><strong>NOTE:</strong> It is important to note that <em>ssh-keygen</em> generates a public/private keypair (e.g. id_rsa and id_rsa.pub). You want to upload the <em>public</em> key, which is denoted by the <em>.pub</em> file extension.</p>
<h4 class="section" id='H4'><a href="#H4" class="sectionlink"><i class="icon-share-alt"> </i></a>Uploading your public key from the command-line</h4><p>Then you can upload your <em>public</em> key right from the command-line.</p>
<pre><code>cat ~/.ssh/id_rsa.pub | ssh -l &lt;username&gt; -p 29418 &lt;hostname&gt; keys add
cat c:\&lt;userfolder&gt;\.ssh\id_rsa.pub | ssh -l &lt;username&gt; -p 29418 &lt;hostname&gt; keys add
</code></pre>
<h4 class="section" id='H5'><a href="#H5" class="sectionlink"><i class="icon-share-alt"> </i></a>Uploading your public key through the browser</h4>
<ol>
  <li>Navigate to your <em>profile</em> page from the dropdown user menu.</li>
  <li>Click the <em>SSH Keys</em> tab and paste your public key into the <em>Add SSH Key</em> form.</li>
  <li>Click the <em>Save</em> button</li>
</ol><p>Once you ave uploaded your public key you should be able to execute the following command without a password prompt.</p>
<pre><code>ssh -l &lt;username&gt; -p 29418 &lt;hostname&gt;
</code></pre>
<h3 class="section" id='H6'><a href="#H6" class="sectionlink"><i class="icon-share-alt"> </i></a>Setting up an SSH alias</h3><p>Typing the following command syntax all the time gets to be rather tedious.</p>
<pre><code>ssh -l &lt;username&gt; -p 29418 &lt;hostname&gt;
</code></pre><p>You can define an alias for your server which will reduce your command syntax to something like this.</p>
<pre><code>ssh &lt;alias&gt;
</code></pre><p>Create or modify your <code>~/.ssh/config</code> file and add a host entry. If you are on Windows, you'll want to create or modify <code>&lt;userfolder&gt;\.ssh\config</code>, where <em>userfolder</em> is dependent on your version of Windows. Most recently this is <code>c:\users\&lt;userfolder&gt;</code>.</p>
<pre><code>Host &lt;alias&gt;
    IdentityFile ~/.ssh/id_rsa
    User &lt;username&gt;
    Port 29418
    HostName &lt;hostname&gt;
</code></pre>
<h3 class="section" id='H7'><a href="#H7" class="sectionlink"><i class="icon-share-alt"> </i></a>SSH Commands</h3><p>Gitblit supports SSH command plugins and provides several commands out-of-the-box.</p>
<h4 class="section" id='H8'><a href="#H8" class="sectionlink"><i class="icon-share-alt"> </i></a>keys</h4><p>The <em>keys</em> command dispatcher allows you to manage your public ssh keys. You can list keys, add keys, remove keys, and identify the key in-use for the active session.</p>
<h5 class="section" id='H9'><a href="#H9" class="sectionlink"><i class="icon-share-alt"> </i></a>keys add</h5><p>Add an SSH public key to your account. This command accepts a public key piped to stdin.</p>
<pre><code>cat ~/.ssh/id_rsa.pub | ssh -l &lt;username&gt; -p 29418 &lt;hostname&gt; keys add
</code></pre>
<h5 class="section" id='H10'><a href="#H10" class="sectionlink"><i class="icon-share-alt"> </i></a>keys list</h5><p>Show the SSH public keys you have added to your account.</p>
<pre><code>ssh -l &lt;username&gt; -p 29418 &lt;hostname&gt; keys list
</code></pre>
<h5 class="section" id='H11'><a href="#H11" class="sectionlink"><i class="icon-share-alt"> </i></a>keys remove</h5><p>Remove an SSH public key from your account. This command accepts several input values, the most useful one is an index number which matches the index number displayed in the <code>list</code> command.</p>
<pre><code>ssh -l &lt;username&gt; -p 29418 &lt;hostname&gt; keys remove 2
</code></pre><p>You can also remove all your public keys from your account.</p>
<pre><code>ssh -l &lt;username&gt; -p 29418 &lt;hostname&gt; keys remove ALL
</code></pre>
<h5 class="section" id='H12'><a href="#H12" class="sectionlink"><i class="icon-share-alt"> </i></a>keys permission</h5><p>You may control the access permission for each SSH key. This is more of a safety feature than a security measure.</p>
<table>
  <thead>
    <tr>
      <th>Permission </th>
      <th>Description </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>V </td>
      <td>SSH key may not be used for clone/fetch or push </td>
    </tr>
    <tr>
      <td>R </td>
      <td>SSH key may be used to clone/fetch </td>
    </tr>
    <tr>
      <td>RW </td>
      <td>SSH key may be used to clone/fetch and push </td>
    </tr>
  </tbody>
</table>
<h3 class="section" id='H13'><a href="#H13" class="sectionlink"><i class="icon-share-alt"> </i></a>Mac OSX Fonts</h3><p>Many of Gitblit's SSH commands rely on ANSI border characters to provide a pretty presentation of data. Unfortunately, the fonts provided by Apple - while very nice - don't work well with ANSI border characters. The following public domain fixed-width, fixed-point, bitmapped fonts work very nicely. I find the 6x12 font with a line spacing of ~0.8 to be quite acceptable.</p><p><a href="6x12.dfont">6x12.dfont</a><br/><a href="6x13.dfont">6x13.dfont</a><br/><a href="7x13.dfont">7x13.dfont</a><br/><a href="7x14.dfont">7x14.dfont</a>
<!-- End Markdown -->
<div ><ul class="pager"><li class="previous"><a href="setup_transport_http.html">&larr; using HTTP/HTTPS</a></li> <li class="next"><a href="eclipse_plugin.html">using the Eclipse plugin &rarr;</a></li></ul></div><footer class="footer"><p class="pull-right">generated 2015-11-23</p>
<p>The content of this page is licensed under the <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution 3.0 License</a>.</p>
</footer>
</div>
<!-- Google Analytics -->
<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-24377072-1']);
    _gaq.push(['_trackPageview']);
 
    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
</script>
 
</body>
</html>