{"thread":{"id":"58158","subject":"Create Remote Repository from local","startedAt":"2022-07-14T09:50:55Z","lastAt":"2022-07-14T10:15:04Z","messageCount":2,"participants":["Antonio Cabañas Zurita","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"459035","messageId":"CADxQiQZR2pM4F3vizq_HyM6xeZMRHstNHPk2rXuux7LgqWkUfg@mail.gmail.com","threadId":"58158","inReplyTo":null,"subject":"Create Remote Repository from local","fromName":"Antonio Cabañas Zurita","fromEmail":"antoniozurita99@gmail.com","sentAt":"2022-07-14T09:50:04Z","receivedAt":"2022-07-14T09:50:55Z","isPatch":false,"sender":{"key":"antoniozurita99@gmail.com","avatar":null},"body":"Hi,\n\nI'm setting up a git server, but I've run into a little problem.\n\nIt is possible to generate a remote repository on the server from a\nlocal repository, or for this it must be created on the remote\n(server), regardless of whether it is by cloning or by remote add.\n\nAssuming that I am in a newly created local repository I have tried:\n\nDo a git remote add ssh://git@git/<location>\n\nAnd I have not previously created a repository in location(on the\nserver side), it returns an error that it is not a known repository in\nthe destination.\n\nI do not know if I explained well.\n\nThank you for your your time,\n\nCheers\n"},{"id":"459036","messageId":"220714.8635f42e72.gmgdl@evledraar.gmail.com","threadId":"58158","inReplyTo":"CADxQiQZR2pM4F3vizq_HyM6xeZMRHstNHPk2rXuux7LgqWkUfg@mail.gmail.com","subject":"Re: Create Remote Repository from local","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-07-14T10:11:01Z","receivedAt":"2022-07-14T10:15:04Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Jul 14 2022, Antonio Cabañas Zurita wrote:\n\n> Hi,\n>\n> I'm setting up a git server, but I've run into a little problem.\n>\n> It is possible to generate a remote repository on the server from a\n> local repository, or for this it must be created on the remote\n> (server), regardless of whether it is by cloning or by remote add.\n>\n> Assuming that I am in a newly created local repository I have tried:\n>\n> Do a git remote add ssh://git@git/<location>\n>\n> And I have not previously created a repository in location(on the\n> server side), it returns an error that it is not a known repository in\n> the destination.\n\nThe default local git client + server setup does not automatically\ncreate repos on the remote, do you mean that you'd like to \"git init\"\nlocally, then just have a \"git remote add\" on your own server create it?\n\nThat *is* possible, and I've worked with a server seup like that, it\njust used a git-shell(1) replacement to intercept the \"git upload-pack\"\ncommand, i.e. you'll get a /path/to/repo.git\" argument, which you can\njust intercept and \"git init\" that repo on the server, then serve the\nnormal \"git-upload-pack\" on that newly created repo.\n\nUsing that method you can:\n\n\t# locally\n\tgit init r &&\n\techo hi >r/file &&\n\tgit -C r add file &&\n\tgit -C r commit file &&\n\tgit -C r push <some server url> master:master\n\nOr whatever, and have it work.\n\nBut I don't know (and didn't test) how that works with \"git remote add\",\ni.e. if the remote addition will expect a remote branch in some sensble\nstate on the remote.\n\nSo I could see how you'd get into a chicken & egg problem there,\ni.e. you'd want to find the remote state, but your repo hasn't been\ncreated yet...\n"}]}