Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I connect to my server using SSH:

ssh user@server -p 2224 -zZ abcd

I also have a git repository on my server. The only way I know to clone is:

git clone ssh://user@server.com:2224/path/to/repo

Using the above command I can't connect to my server because -zZ abcd is not in the command. I tried the following commands but doesn't work.

git clone ssh://user@server.com:2224/path/to/repo -zZ abcd

git clone "ssh://user@server.com:2224/path/to/repo -zZ abcd"

How can I include ssh parameters in git-clone command?

share|improve this question
Read also Passing ssh options to git clone –  Lazy Badger Mar 10 '12 at 20:02

2 Answers 2

You may set up configuration options to save typing; so, after

$ cat >>.git/config <<EOF
[remote "myrepo"]
    url = ssh://user@server.com:2224/path/to/repo -zZ abcd

use just git clone myrepo

See the explanations of the remote..url options in git config for details.

share|improve this answer

Another possibility is to set per-host ssh options. This can be nice when you want the ssh options to work for all ssh commands and not just for git. These options go in ~/.ssh/config and are documented in man ssh_config. For example, ~/.ssh/config might include something like:

Host server.com
Compression "yes"
ConnectTimeout 4
GlobalKnownHostsFile /path/to/hosts_file
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.