threads / discuss / 45822

git with ssh won't pull submodule

Subject: git with ssh won't pull submodule

## tl;dr

3 messages between Apr 27, 2017 and Apr 29, 2017.

replies: 2people: 2as markdown or json

Erik Haller· Apr 27, 2017, 23:25 UTC · lore
Getting the following error for a submodule when using git/ssh:

$ git clone --recursive ssh://incense:/home/erik/git/nacl.git Cloning into 'nacl'... remote: Counting objects: 32, done. remote: Compressing objects: 100% (25/25), done. remote: Total 32 (delta 5), reused 0 (delta 0) Receiving objects: 100% (32/32), 16.50 KiB | 0 bytes/s, done. Resolving deltas: 100% (5/5), done. Submodule 'vendor/golang.org/x/crypto' (file:///home/erik/git/github.com/golang/crypto.git) registered for path 'vendor/golang.org/x/crypto' Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'... fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear to be a git repository fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git' into submodule path '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed Failed to clone 'vendor/golang.org/x/crypto'. Retry scheduled Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'... fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear to be a git repository fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git' into submodule path '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed Failed to clone 'vendor/golang.org/x/crypto' a second time, aborting

The git clone --recursive file:///home/erik/git/nacl.git works fine and pulls the submodule "crypto.git". Any ideas?

- The crypto.git is a valid repo.
- I have the correct permissions.
- The crypto.git repo is a git --mirror repo.

git version: 2.11.0 system: linux debian/testing

Chris Packham· Apr 28, 2017, 15:45 UTC · re: Erik Haller · lore

Re: git with ssh won't pull submodule

Hi Erik,
On Fri, Apr 28, 2017 at 11:25 AM, Erik Haller <erik.haller@gmail.com> wrote:
Show 12 quoted lines
> Getting the following error for a submodule when using git/ssh:
>
> $ git clone --recursive ssh://incense:/home/erik/git/nacl.git
> Cloning into 'nacl'...
> remote: Counting objects: 32, done.
> remote: Compressing objects: 100% (25/25), done.
> remote: Total 32 (delta 5), reused 0 (delta 0)
> Receiving objects: 100% (32/32), 16.50 KiB | 0 bytes/s, done.
> Resolving deltas: 100% (5/5), done.
> Submodule 'vendor/golang.org/x/crypto'
> (file:///home/erik/git/github.com/golang/crypto.git) registered for
> path 'vendor/golang.org/x/crypto'

This is the problem. The .gitmodules entry in nacl.git uses an absolute path (or URI in this case) for the submodule. Git does exactly what it should and tries to clone it.

The solution to this is to use a relative path[1] in .gitmodules (either edit it by hand or do git rm & git submodule add). Note that by using a relative path it assumes that the parent and submodule repositories are hosted in the same location (which may or may not be true for your use-case).

-- [1] - see the 3rd paragraph for the add command in https://git-scm.com/docs/git-submodule

Show 34 quoted lines
> Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...
> fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear
> to be a git repository
> fatal: Could not read from remote repository.
>
> Please make sure you have the correct access rights
> and the repository exists.
> fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'
> into submodule path
> '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed
> Failed to clone 'vendor/golang.org/x/crypto'. Retry scheduled
> Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...
> fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear
> to be a git repository
> fatal: Could not read from remote repository.
>
> Please make sure you have the correct access rights
> and the repository exists.
> fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'
> into submodule path
> '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed
> Failed to clone 'vendor/golang.org/x/crypto' a second time, aborting
>
>
> The git clone --recursive file:///home/erik/git/nacl.git works fine
> and pulls the submodule "crypto.git". Any ideas?
>
> - The crypto.git is a valid repo.
> - I have the correct permissions.
> - The crypto.git repo is a git --mirror repo.
>
>
> git version: 2.11.0
> system: linux debian/testing
Erik Haller· Apr 29, 2017, 22:23 UTC · re: Chris Packham · lore

Re: git with ssh won't pull submodule

Ah. I was able to get it to work with the ssh protocol and a relative path. Thank you for your help.

On Fri, Apr 28, 2017 at 8:45 AM, Chris Packham <judge.packham@gmail.com> wrote:
Show 64 quoted lines
> Hi Erik,
>
> On Fri, Apr 28, 2017 at 11:25 AM, Erik Haller <erik.haller@gmail.com> wrote:
>> Getting the following error for a submodule when using git/ssh:
>>
>> $ git clone --recursive ssh://incense:/home/erik/git/nacl.git
>> Cloning into 'nacl'...
>> remote: Counting objects: 32, done.
>> remote: Compressing objects: 100% (25/25), done.
>> remote: Total 32 (delta 5), reused 0 (delta 0)
>> Receiving objects: 100% (32/32), 16.50 KiB | 0 bytes/s, done.
>> Resolving deltas: 100% (5/5), done.
>> Submodule 'vendor/golang.org/x/crypto'
>> (file:///home/erik/git/github.com/golang/crypto.git) registered for
>> path 'vendor/golang.org/x/crypto'
>
> This is the problem. The .gitmodules entry in nacl.git uses an
> absolute path (or URI in this case) for the submodule. Git does
> exactly what it should and tries to clone it.
>
> The solution to this is to use a relative path[1] in .gitmodules
> (either edit it by hand or do git rm & git submodule add). Note that
> by using a relative path it assumes that the parent and submodule
> repositories are hosted in the same location (which may or may not be
> true for your use-case).
>
> --
> [1] - see the 3rd paragraph for the add command in
> https://git-scm.com/docs/git-submodule
>
>> Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...
>> fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear
>> to be a git repository
>> fatal: Could not read from remote repository.
>>
>> Please make sure you have the correct access rights
>> and the repository exists.
>> fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'
>> into submodule path
>> '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed
>> Failed to clone 'vendor/golang.org/x/crypto'. Retry scheduled
>> Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...
>> fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear
>> to be a git repository
>> fatal: Could not read from remote repository.
>>
>> Please make sure you have the correct access rights
>> and the repository exists.
>> fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'
>> into submodule path
>> '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed
>> Failed to clone 'vendor/golang.org/x/crypto' a second time, aborting
>>
>>
>> The git clone --recursive file:///home/erik/git/nacl.git works fine
>> and pulls the submodule "crypto.git". Any ideas?
>>
>> - The crypto.git is a valid repo.
>> - I have the correct permissions.
>> - The crypto.git repo is a git --mirror repo.
>>
>>
>> git version: 2.11.0
>> system: linux debian/testing

← back to recent threads