git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Clone to an SSH destination

From
KKKonstantin Khomoutov <flatworm@users.sourceforge.net>
Date
Sep 3, 2012, 11:47 UTC
Message-ID
<20120903154732.5fb50b173fa51db8300624b3@domain007.com>
In-Reply-To
<alpine.LFD.2.01.1209031059480.4753@sys880.ldn.framestore.com>

On Mon, 3 Sep 2012 11:21:43 +0100 (BST) Mark Hills <Mark.Hills@framestore.com> wrote:

Show 8 quoted lines
> How do I clone a repo _to_ a new repo over SSH? I tried:
> 
>   cd xx
>   git clone --bare . gitserver:/scm/xx.git
>   git clone --bare . ssh://gitserver/scm/xx.git
>
> This does not have the expected result, and instead a local path of
> the given name is created (eg. a 'gitserver:' directory)

No, `git clone` is intended to work with your local machine. And I can't really imagine how it would work in a way you want.

Show 9 quoted lines
> This seems to be a FAQ, but the only answer I can find (Google) is to 
> login to the server and create the repo, setup a remote and push to
> it. 
> This is quite cumbersome; we have a large team of devs who use a
> simple 'git clone' to an NFS directory, but we wish to retire NFS
> access.
> 
> Is there a technical limiation preventing clone-to-ssh, or just
> something waiting to be implemented?

I think this is more a conceptual issue: such a "remote cloning" would mean *creation* of a repository as part of the process. I'm not aware of any [D]VCS system which would routinely allow such a thing: usually the creation of a repository is an "administrative" act, which is distinct from regular (push/fetch) access to that repository.

gitolite kind of implements this ("wild repos") [1], you could look if it suits your needs.

Now back to your problem.
If you have NFS access, you can probably do proper cloning using NFS:
1) Export via NFS the directory in which you want your resulting
   bare repository located.
2) Do simple *local* clone (using paths accessed by NFS):
   git clone --bare /path/to/source/repo /path/to/destination/repo
3) Do certain fixups in the destination repo, if needed, then
   access it normally via SSH (or whatever protocol you prefer).
If you don't want to do this, then revert to a normal two-step
procedure:
1) Log into the server, create a repo by hand:
   git init --bare /path/to/repo
2) Push everything relevant from a source repo there:
   cd /path/to/local/repo
   git remote add origin ssh://gitserver/scm/xx.git
   git push origin refs/*:refs/*

Step (1) may depends on what server-side solution your need; for instance, in gitolite you would be configuring a new repo in the configuration file in your local clone of the gitolite admin repo and pushing your changes to the server.

1. http://sitaramc.github.com/gitolite/wild.html
Previous: Enrico WeigeltNext: Sitaram Chamarty
Message 7 of 10 in “Clone to an SSH destination”
  1. Mark HillsSep 3, 2012
  2. Ævar Arnfjörð BjarmasonSep 3, 2012
  3. Mark HillsSep 3, 2012
  4. Konstantin KhomoutovSep 3, 2012
  5. Sitaram ChamartySep 3, 2012
  6. Enrico WeigeltSep 3, 2012
  7. Konstantin KhomoutovSep 3, 2012
  8. Sitaram ChamartySep 3, 2012
  9. Mark HillsSep 3, 2012
  10. Sitaram ChamartySep 3, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.