2 @heading=How to Setup HTTPS Push
5 <!-- This file is preprocessed by cgi/html.cgi -->
7 <p>The https push facility relies on user client authentication certificates to
8 enable pushing. These certificates are automatically created whenever an
9 RSA SSH public key is included in the
“Public SSH Key(s)
” section
10 of the
<a href=
"/reguser.cgi">Register user
</a> page and may be downloaded
11 from the download link(s) shown on the user registration confirmation page
12 or the
<a href=
"/edituser.cgi">Update user email/SSH Keys
</a> page.
</p>
14 <h2>Prerequisites
</h2>
16 <p>Assuming the user login name is
<tt>test
</tt> and the
17 <a href=
"@@path(webadmurl)@@/@@nickname@@_root_cert.pem">root certificate
</a>
18 has been downloaded to
<tt>$HOME/certs/@@nickname@@_root_cert.pem
</tt> (see
19 <a href=
"@@path(htmlurl)@@/rootcert.html">here
</a> for more information about the
20 <a href=
"@@path(webadmurl)@@/@@nickname@@_root_cert.pem">root certificate
</a>),
21 the single RSA SSH public key from
<tt>$HOME/.ssh/id_rsa.pub
</tt> has been uploaded
22 as the sole public key for the
<tt>test
</tt> user and the resulting
23 <tt>test
</tt> user authentication certifcate has been downloaded to
24 <tt>$HOME/certs/@@nickname@@_test_user_1.pem
</tt>, the following
25 shows how to clone and then push to a
<tt>mobexample.git
</tt> project using
26 only the smart HTTP protocol.
</p>
28 <p style=
"border:thin dotted black;background-color:#eef;padding:0.5ex 1ex;max-width:90ex">An
29 https push user authentication certificate may be downloaded from the
30 <a href=
"/reguser.cgi">Register user
</a> confirmation page or the
31 <a href=
"/edituser.cgi">Update user email/SSH Keys
</a> page.
</p>
35 <p>It
’s possible to both fetch and push over https. It
’s also
36 possible to fetch over http and push over https. There
’s an example
39 <pre style=
"margin:3ex">
40 # the @@nickname@@ root certificate is in $HOME/certs/@@nickname@@_root_cert.pem
41 # the test user certificate is in $HOME/certs/@@nickname@@_test_user_1.pem
42 # the $HOME/.ssh/id_rsa.pub SSH public key was uploaded
43 # the $HOME/.ssh/id_rsa file is the $HOME/.ssh/id_rsa.pub private key
46 <p id=
"git185" style=
"margin:3ex"><b>Using Git version
1.8.5 or later:
</b></p>
48 <pre style=
"margin:3ex">
49 # one-time global URL-specific configuration
50 # (requires Git version
1.8.5 or later)
51 git config --global http.@@base(httpspushurl)@@.sslCAInfo \
52 $HOME/certs/@@nickname@@_root_cert.pem
53 git config --global http.@@base(httpspushurl)@@.sslCert \
54 $HOME/certs/@@nickname@@_test_user_1.pem
55 git config --global http.@@base(httpspushurl)@@.sslKey \
59 git clone @@httppullurl@@/mobexample.git mob1
62 git clone @@httpspushurl@@/mobexample.git mob2
64 # configure mob1 to push over https
66 git remote set-url --push origin @@httpspushurl@@/mobexample.git
70 # push will fail because test does not have push permission
73 # configure mob2 to fetch and push over https
75 # nothing needs to be done, the clone
& global config took care of it
79 # push will fail because test does not have push permission
83 <p style=
"margin:3ex"><b>Using any version of Git:
</b></p>
85 <pre style=
"margin:3ex">
90 git clone @@httppullurl@@/mobexample.git mob1
93 GIT_SSL_CAINFO=$HOME/certs/@@nickname@@_root_cert.pem \
94 git clone @@httpspushurl@@/mobexample.git mob2
96 # configure mob1 to push over https
98 git config http.sslCAInfo $HOME/certs/@@nickname@@_root_cert.pem
99 git config http.sslCert $HOME/certs/@@nickname@@_test_user_1.pem
100 git config http.sslKey $HOME/.ssh/id_rsa
101 git remote set-url --push origin @@httpspushurl@@/mobexample.git
105 # push will fail because test does not have push permission
106 git push --all origin
108 # configure mob2 to fetch and push over https
110 git config http.sslCAInfo $HOME/certs/@@nickname@@_root_cert.pem
111 git config http.sslCert $HOME/certs/@@nickname@@_test_user_1.pem
112 git config http.sslKey $HOME/.ssh/id_rsa
116 # push will fail because test does not have push permission
117 git push --all origin
120 <p>The example
<tt>git push
</tt> commands above will fail with a push permission
121 error since the test user does not have permission to push to the
122 <tt>mobexample.git
</tt> project@@ifmob@@, but the mob user can push to the mob branch of
123 <tt>mobexample.git
</tt> over https as detailed
124 <a href=
"@@path(htmlurl)@@/mob.html#httpsmobpush">here
</a>@@end@@.
</p>
126 <h2>Password Caching
</h2>
128 <p>In the above examples, if the
<tt>$HOME/.ssh/id_rsa
</tt> private key is password
129 protected, then it
’s desirable to set
<tt>http.sslCertPasswordProtected
</tt>
132 <pre style=
"margin:3ex">
133 # with the current directory /tmp/mob1 or /tmp/mob2
134 git config --bool http.sslCertPasswordProtected true
137 <p>If using Git version
1.8.5 or later the
<tt>http.sslCertPasswordProtected
</tt> setting
138 may be applied only to specific URLs (such as
<tt>@@base(httpspushurl)@@
</tt>). See the output
139 of
<tt>git config help
</tt> for more information.
</p>