{"thread":{"id":"45822","subject":"git with ssh won't pull submodule","startedAt":"2017-04-27T23:25:13Z","lastAt":"2017-04-29T22:23:19Z","messageCount":3,"participants":["Erik Haller","Chris Packham"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"318107","messageId":"CAJRbB6w2BnXXzA46a-uzpx9u554GndEXxZtkLVTc5XOXMn3kkA@mail.gmail.com","threadId":"45822","inReplyTo":null,"subject":"git with ssh won't pull submodule","fromName":"Erik Haller","fromEmail":"erik.haller@gmail.com","sentAt":"2017-04-27T23:25:05Z","receivedAt":"2017-04-27T23:25:13Z","isPatch":false,"sender":{"key":"erik.haller@gmail.com","avatar":null},"body":"Getting the following error for a submodule when using git/ssh:\n\n$ git clone --recursive ssh://incense:/home/erik/git/nacl.git\nCloning into 'nacl'...\nremote: Counting objects: 32, done.\nremote: Compressing objects: 100% (25/25), done.\nremote: Total 32 (delta 5), reused 0 (delta 0)\nReceiving objects: 100% (32/32), 16.50 KiB | 0 bytes/s, done.\nResolving deltas: 100% (5/5), done.\nSubmodule 'vendor/golang.org/x/crypto'\n(file:///home/erik/git/github.com/golang/crypto.git) registered for\npath 'vendor/golang.org/x/crypto'\nCloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...\nfatal: '/home/erik/git/github.com/golang/crypto.git' does not appear\nto be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\nfatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'\ninto submodule path\n'/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed\nFailed to clone 'vendor/golang.org/x/crypto'. Retry scheduled\nCloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...\nfatal: '/home/erik/git/github.com/golang/crypto.git' does not appear\nto be a git repository\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\nfatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'\ninto submodule path\n'/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed\nFailed to clone 'vendor/golang.org/x/crypto' a second time, aborting\n\n\nThe git clone --recursive file:///home/erik/git/nacl.git works fine\nand pulls the submodule \"crypto.git\". Any ideas?\n\n- The crypto.git is a valid repo.\n- I have the correct permissions.\n- The crypto.git repo is a git --mirror repo.\n\n\ngit version: 2.11.0\nsystem: linux debian/testing\n"},{"id":"318188","messageId":"CAFOYHZAsGp8Fw4euxsr=hRbTm5voBSRf_tJ9y3Sz25AE=VQ3hw@mail.gmail.com","threadId":"45822","inReplyTo":"CAJRbB6w2BnXXzA46a-uzpx9u554GndEXxZtkLVTc5XOXMn3kkA@mail.gmail.com","subject":"Re: git with ssh won't pull submodule","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2017-04-28T15:45:31Z","receivedAt":"2017-04-28T15:45:37Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"Hi Erik,\n\nOn Fri, Apr 28, 2017 at 11:25 AM, Erik Haller <erik.haller@gmail.com> wrote:\n> Getting the following error for a submodule when using git/ssh:\n>\n> $ git clone --recursive ssh://incense:/home/erik/git/nacl.git\n> Cloning into 'nacl'...\n> remote: Counting objects: 32, done.\n> remote: Compressing objects: 100% (25/25), done.\n> remote: Total 32 (delta 5), reused 0 (delta 0)\n> Receiving objects: 100% (32/32), 16.50 KiB | 0 bytes/s, done.\n> Resolving deltas: 100% (5/5), done.\n> Submodule 'vendor/golang.org/x/crypto'\n> (file:///home/erik/git/github.com/golang/crypto.git) registered for\n> path 'vendor/golang.org/x/crypto'\n\nThis is the problem. The .gitmodules entry in nacl.git uses an\nabsolute path (or URI in this case) for the submodule. Git does\nexactly what it should and tries to clone it.\n\nThe solution to this is to use a relative path[1] in .gitmodules\n(either edit it by hand or do git rm & git submodule add). Note that\nby using a relative path it assumes that the parent and submodule\nrepositories are hosted in the same location (which may or may not be\ntrue for your use-case).\n\n--\n[1] - see the 3rd paragraph for the add command in\nhttps://git-scm.com/docs/git-submodule\n\n> Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...\n> fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear\n> to be a git repository\n> fatal: Could not read from remote repository.\n>\n> Please make sure you have the correct access rights\n> and the repository exists.\n> fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'\n> into submodule path\n> '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed\n> Failed to clone 'vendor/golang.org/x/crypto'. Retry scheduled\n> Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...\n> fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear\n> to be a git repository\n> fatal: Could not read from remote repository.\n>\n> Please make sure you have the correct access rights\n> and the repository exists.\n> fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'\n> into submodule path\n> '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed\n> Failed to clone 'vendor/golang.org/x/crypto' a second time, aborting\n>\n>\n> The git clone --recursive file:///home/erik/git/nacl.git works fine\n> and pulls the submodule \"crypto.git\". Any ideas?\n>\n> - The crypto.git is a valid repo.\n> - I have the correct permissions.\n> - The crypto.git repo is a git --mirror repo.\n>\n>\n> git version: 2.11.0\n> system: linux debian/testing\n"},{"id":"318247","messageId":"CAJRbB6wz5y=GJLq1gWnmWC7CbPJdqjUn97dAW9SaftnSWVaaag@mail.gmail.com","threadId":"45822","inReplyTo":"CAFOYHZAsGp8Fw4euxsr=hRbTm5voBSRf_tJ9y3Sz25AE=VQ3hw@mail.gmail.com","subject":"Re: git with ssh won't pull submodule","fromName":"Erik Haller","fromEmail":"erik.haller@gmail.com","sentAt":"2017-04-29T22:23:12Z","receivedAt":"2017-04-29T22:23:19Z","isPatch":false,"sender":{"key":"erik.haller@gmail.com","avatar":null},"body":"Ah. I was able to get it to work with the ssh protocol and a relative\npath. Thank you for your help.\n\nOn Fri, Apr 28, 2017 at 8:45 AM, Chris Packham <judge.packham@gmail.com> wrote:\n> Hi Erik,\n>\n> On Fri, Apr 28, 2017 at 11:25 AM, Erik Haller <erik.haller@gmail.com> wrote:\n>> Getting the following error for a submodule when using git/ssh:\n>>\n>> $ git clone --recursive ssh://incense:/home/erik/git/nacl.git\n>> Cloning into 'nacl'...\n>> remote: Counting objects: 32, done.\n>> remote: Compressing objects: 100% (25/25), done.\n>> remote: Total 32 (delta 5), reused 0 (delta 0)\n>> Receiving objects: 100% (32/32), 16.50 KiB | 0 bytes/s, done.\n>> Resolving deltas: 100% (5/5), done.\n>> Submodule 'vendor/golang.org/x/crypto'\n>> (file:///home/erik/git/github.com/golang/crypto.git) registered for\n>> path 'vendor/golang.org/x/crypto'\n>\n> This is the problem. The .gitmodules entry in nacl.git uses an\n> absolute path (or URI in this case) for the submodule. Git does\n> exactly what it should and tries to clone it.\n>\n> The solution to this is to use a relative path[1] in .gitmodules\n> (either edit it by hand or do git rm & git submodule add). Note that\n> by using a relative path it assumes that the parent and submodule\n> repositories are hosted in the same location (which may or may not be\n> true for your use-case).\n>\n> --\n> [1] - see the 3rd paragraph for the add command in\n> https://git-scm.com/docs/git-submodule\n>\n>> Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...\n>> fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear\n>> to be a git repository\n>> fatal: Could not read from remote repository.\n>>\n>> Please make sure you have the correct access rights\n>> and the repository exists.\n>> fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'\n>> into submodule path\n>> '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed\n>> Failed to clone 'vendor/golang.org/x/crypto'. Retry scheduled\n>> Cloning into '/home/erik/go/src/nacl/vendor/golang.org/x/crypto'...\n>> fatal: '/home/erik/git/github.com/golang/crypto.git' does not appear\n>> to be a git repository\n>> fatal: Could not read from remote repository.\n>>\n>> Please make sure you have the correct access rights\n>> and the repository exists.\n>> fatal: clone of 'file:///home/erik/git/github.com/golang/crypto.git'\n>> into submodule path\n>> '/home/erik/go/src/nacl/vendor/golang.org/x/crypto' failed\n>> Failed to clone 'vendor/golang.org/x/crypto' a second time, aborting\n>>\n>>\n>> The git clone --recursive file:///home/erik/git/nacl.git works fine\n>> and pulls the submodule \"crypto.git\". Any ideas?\n>>\n>> - The crypto.git is a valid repo.\n>> - I have the correct permissions.\n>> - The crypto.git repo is a git --mirror repo.\n>>\n>>\n>> git version: 2.11.0\n>> system: linux debian/testing\n"}]}