...
Yes, by adding a host alias for github.com in your SSH configuration file ~/.ssh/config
(C:\Program Files\Git\etc\ssh\ssh_config
on Windows). Add the following lines to ~/.ssh/config
the SSH configuration file:
Code Block | ||
---|---|---|
| ||
Host github.com github gh User git Hostname github.com |
...
Code Block | ||
---|---|---|
| ||
$ git clone github.com:openjdk/jdk $ git clone github:openjdk/jdk $ git clone gh:openjdk/jdk |
My computer is behind
...
an HTTP(S) proxy, can I still clone using SSH?
Yes, by adding a ProxyCommand
directive in your SSH configuration ~/.ssh/config
. The value for ProxyCommand
is operating system dependent, since different programs are available on different operating systems. Please follow the instructions specific for your operating system below:
...
Substitute PROXY-HOSTNAME
with the hostname of the HTTP(S) proxy server, and PROXY-PORT
with the port of the HTTP(S) proxy server. Note that the full path to nc
must be used since Homebrew might install the GNU version of nc
(which does not support the -X
flag).
Windows
Add the following lines to C:\Program Files\Git\etc\ssh\ssh_config:
Code Block | ||
---|---|---|
| ||
Host github.com github gh
User git
Hostname github.com
ProxyCommand C:\Program Files\Git\mingw64\bin\connect.exe -H PROXY-HOSTNAME:PROXY-HOST %h %p |
Substitute PROXY-HOSTNAME
with the hostname of the HTTP(S) proxy server, and PROXY-PORT
with the port of the HTTP(S) proxy server. Note that the program connect.exe
is part of Git for Windows, if you install Git via some other mechanism then you might have to install connect.exe
yourself.
Shell
Bash
Can I see the currently checked out local branch in my prompt?
...