git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Antonio Cabañas Zurita" <antoniozurita99@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Create Remote Repository from local
Date: Thu, 14 Jul 2022 12:11:01 +0200	[thread overview]
Message-ID: <220714.8635f42e72.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <CADxQiQZR2pM4F3vizq_HyM6xeZMRHstNHPk2rXuux7LgqWkUfg@mail.gmail.com>


On Thu, Jul 14 2022, Antonio Cabañas Zurita wrote:

> Hi,
>
> I'm setting up a git server, but I've run into a little problem.
>
> It is possible to generate a remote repository on the server from a
> local repository, or for this it must be created on the remote
> (server), regardless of whether it is by cloning or by remote add.
>
> Assuming that I am in a newly created local repository I have tried:
>
> Do a git remote add ssh://git@git/<location>
>
> And I have not previously created a repository in location(on the
> server side), it returns an error that it is not a known repository in
> the destination.

The default local git client + server setup does not automatically
create repos on the remote, do you mean that you'd like to "git init"
locally, then just have a "git remote add" on your own server create it?

That *is* possible, and I've worked with a server seup like that, it
just used a git-shell(1) replacement to intercept the "git upload-pack"
command, i.e. you'll get a /path/to/repo.git" argument, which you can
just intercept and "git init" that repo on the server, then serve the
normal "git-upload-pack" on that newly created repo.

Using that method you can:

	# locally
	git init r &&
	echo hi >r/file &&
	git -C r add file &&
	git -C r commit file &&
	git -C r push <some server url> master:master

Or whatever, and have it work.

But I don't know (and didn't test) how that works with "git remote add",
i.e. if the remote addition will expect a remote branch in some sensble
state on the remote.

So I could see how you'd get into a chicken & egg problem there,
i.e. you'd want to find the remote state, but your repo hasn't been
created yet...

      reply	other threads:[~2022-07-14 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14  9:50 Create Remote Repository from local Antonio Cabañas Zurita
2022-07-14 10:11 ` Ævar Arnfjörð Bjarmason [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=220714.8635f42e72.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=antoniozurita99@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).