Sign up ×
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://

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:// -zZ abcd

git clone "ssh:// -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

3 Answers 3

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

$ cat >>.git/config <<EOF
[remote "myrepo"]
    url = ssh:// -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:

Compression "yes"
ConnectTimeout 4
GlobalKnownHostsFile /path/to/hosts_file
share|improve this answer

If you regularly use a repository then you should do this using .ssh/config like amcnabb says, remember that .ssh/config lets you make aliases for configuration options, or maybe .git/config if that's inappropriate for some reason.

If however you must pass ssh really transient config options, like because you're stuck at an airport wifi which blocks ssh, then adapt my usual instructions for ssh over tor :

Install connect in your path, maybe by building connect.c from source

Create a script called git-tbb :

exec ssh -o ProxyCommand="connect -5 -S %h %p" $*

Create a script called git-tbb

export GIT_SSH=`which ssh-tbb` git pull
exec git $*

Rename them to -tor if you change the port to 9050 for the default tor config, as opposed to TBB's default 9150.

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.