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.
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.
LikeLike
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).
LikeLike