––thursday #6: using git over ssh

Got a secret project on machine A and too cheap to get a Github private repo? Clone it directly on machine B with:

$ git clone ssh://user@A/absolute/path/to/repo/

Replace “user” with your username on A, “A” with the actual hostname of A, and “/absolute/path/to/repo/” with the absolute path to the git repository.

Join the Conversation


  1. I’m using this method, but don’t bother with url schema, git tries ssh by default.

    Also, it is possible to not put username into the ~/.ssh/config like this:

    # ~/.ssh/config
    Host git
    Hostname mymachine.with.git
    Username ubuntu

    In that case, you will be able to do:

    git clone git:~/private-reps/some-rep.git

    Note, that I’m using not abolute path, but relative to the $HOME directory. And also, I’m clonning from a bare git repository. Bare repositories are safe to push and they are not waste space for the working copy.


    1. Cool, that’s a nice way to set it up.

      In my case, I didn’t want a bare repo because I’m working on my laptop & desktop (so I wanted the full copy of the repo on both).


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: