Re: Why not clone to a remote directory over SSH

5 messages, 5 authors, 2016-06-15 · open the first message on its own page

Re: Why not clone to a remote directory over SSH

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:13

Carl Baldwin [off-list ref] writes:
It might be cool to enable cloning to a remote over ssh if the remote
doesn't yet exist.

% git clone . machine:/path/to/new/repository
I wonder if that is:

	$ ssh machine 'git clone '`hostname`:`pwd`' /path/to/new/repository'

Obviously you need a working git setup on the other end and
probably need to be much more careful shell-quoting if your
hostname and pwd has metacharacters, but...

Re: Why not clone to a remote directory over SSH

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:13

Hi,

On Wed, 23 Nov 2005, Junio C Hamano wrote:
	$ ssh machine 'git clone '`hostname`:`pwd`' /path/to/new/repository'
Obviously, this only works if the other side can connect to this side via 
ssh. Hmm. Firewalls? Disabled sshd? `hostname` not reliably returning a 
valid address for the remote side?

Hth,
Dscho

Re: Why not clone to a remote directory over SSH

From: Nick Hengeveld <hidden>
Date: 2016-06-15 22:42:13

On Thu, Nov 24, 2005 at 12:41:56AM +0100, Johannes Schindelin wrote:
Obviously, this only works if the other side can connect to this side via 
ssh. Hmm. Firewalls? Disabled sshd? `hostname` not reliably returning a 
valid address for the remote side?
If sshd is running locally, you can forward a port back to yourself and
have the remote clone localhost:`pwd`.  Assuming there's a way to clone
using a nonstandard port.

-- 
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.

Re: Why not clone to a remote directory over SSH

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:13


On Thu, 24 Nov 2005, Johannes Schindelin wrote:
On Wed, 23 Nov 2005, Junio C Hamano wrote:
quoted
	$ ssh machine 'git clone '`hostname`:`pwd`' /path/to/new/repository'
Obviously, this only works if the other side can connect to this side via 
ssh. Hmm. Firewalls? Disabled sshd? `hostname` not reliably returning a 
valid address for the remote side?
Well, you could also just script it and just do

	ssh machine 'mkdir -p /path/to/new/repository ;
		cd /path/to/new/repo;
		git-init-db'
	git push --all machine:/path/to/new/repository
	ssh machine 'cd /path/to/new/repo ; git checkout'

(and yes, we could obviously make this a "git-create-repo" command, and 
then you could do

	git-send-pack --exec=git-create-repo \
		machine:/path/to/new/repository
		$(git-rev-parse --all)

or something like that).

		Linus

Re: Why not clone to a remote directory over SSH

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:42:13

Nick Hengeveld wrote:
On Thu, Nov 24, 2005 at 12:41:56AM +0100, Johannes Schindelin wrote:

quoted
Obviously, this only works if the other side can connect to this side via 
ssh. Hmm. Firewalls? Disabled sshd? `hostname` not reliably returning a 
valid address for the remote side?

If sshd is running locally, you can forward a port back to yourself and
have the remote clone localhost:`pwd`.  Assuming there's a way to clone
using a nonstandard port.
ssh://host.xz:port/path/to/repo.git

should work. If it doesn't I'll fix it.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help