Re: Relative url values in .gitmodules confusingly sensitive to clone via ssh vs https.
- From
- Benjamin Shropshire <benjamin.shropshire@economicmodeling.com>
- Date
- Mar 18, 2020, 16:02 UTC
- Message-ID
- <CAAjm7Gb8DdGUCfoPO+p2=YsmvFj5eoCn3jjEbwg3-hwRnt0Q9A@mail.gmail.com>
- In-Reply-To
- <20200318002630.GA366567@camp.crustytoothpaste.net>
On Tue, Mar 17, 2020 at 5:26 PM brian m. carlson <sandals@crustytoothpaste.net> wrote:
Show 32 quoted lines
> On 2020-03-17 at 18:34:09, Benjamin Shropshire wrote: > > From my perspective, this is a bug. > > > > If I clone a repo twice like this: > > > > git clone https://github.com/user/repo.git ./https > > git clone git@github.com:user/repo.git ./ssh > > > > And if it contains a .gitmodules like this: > > > > [submodule "x"] > > path = xxx > > url = ../../different-user/something.git > > > > When I `git submodule update --init --recursive` in each, only the > > HTTPS version works. the SSH version confusingly seems to try to find > > something at ~/different-user/something.git or some other path in the > > local file system. > > > > this seems consistent with the URL parsing resulting in different > > segmentation and thus the ../../ ending up in different places: > > Looking at the code, it appears that we don't let you go above the top > of the URL, which makes sense. So we interpret it as a file system > path. > > (And since this SSH format is not technically a URL, we don't have a > root slash, which is probably why this is a problem.) > > Does it work if you write the following? > > git clone git@github.com:/user/repo.git ./ssh
That seems to work... thought if the final resolution is telling people to just use a particular format for the repo address, I'd vote for telling them to use a full and proper ssh:// URL. (Technically I think `git@host:/...` may be a protocol relative URL? or maybe that would need to be `//git@host:/....`?)
> -- > brian m. carlson: Houston, Texas, US > OpenPGP: https://keybase.io/bk2204