1

I'm trying to understand git submodules and I'm interested in playing around with Shopify Mobile Buy SDK. https://github.com/Shopify/mobile-buy-sdk-ios.

However, as per the installation directions, when I type:

git submodule add git@github.com:Shopify/mobile-buy-sdk-ios.git

into terminal (after cd into my new xcode project), I get the error:

git submodule add git@github.com:Shopify/mobile-buy-sdk-ios.git

As this is the first step of installation and I can't get it to work, I'm at a stand stall with learning. I've researched the problem and I know what each part of the command git submodule add git@github.com:Shopify/mobile-buy-sdk-ios.git means, however I still have no idea where to go from here.

Here is what i'm typing into terminal:

Last login: Mon Oct 14 19:51:07 on ttys000     
Daniels-MBP:~ daniel$ cd desktop/testmeAPP .  
Daniels-MBP:testmeAPP daniel$ ls
testmeAPP       testmeAPP.xcodeproj .  
Daniels-MBP:testmeAPP daniel$ git submodule add git@github.com:Shopify/mobile-buy-sdk-ios.git
fatal: not a git repository (or any of the parent directories): .git .  
Daniels-MBP:testmeAPP daniel$ git ls-remote git@github.com:Shopify/mobile-buy-sdk-ios.git
6f3cff904185833677df7bcbbacc542780448786    HEAD
0455a9cc8c7d269ddc186f5923602251b73b346a    refs/heads/develop
6f3cff904185833677df7bcbbacc542780448786    refs/heads/master
1d260bbca2a9d48de67768de2fa3b5d724852004    refs/heads/sdk-2.1/develop
e3cd35103cec88e96fb4de07a9f4f86ee5719acc    refs/heads/sdk-2.1/master
6ce0b8cf602fc900e17dc34760d1d2f890af226a    refs/pull/10/head
1f3f06c3cc8d79c1f68ecee8de133857d65c0f62    refs/pull/1000/head
5d09b48da862f3479ead3fc38314b1d45ccfc380    refs/pull/1001/head
01f7f4e8c59c4adff0c8107526c726f3e1f78e11    refs/pull/1002/head
410d2eddfd1950fb89f33e2497a4c7a9c04775c9    refs/pull/1006/head
093455879c21a63a8eea481872ce812695737f8a    refs/pull/1008/head


##some output deleted to fit##

44a839c4b1046c16a7fc19b2265b4257e195ee9b    refs/pull/141/head
f2db7008cb09c9a342aba6487bdfdeb8192d5ed3    refs/pull/148/head
9f68b573aa92deba1b9243c60f805234e75c4c12    refs/tags/3.5.3
6cf57078171be3ceab12c9d1dae8aad9dabb5eb0    refs/tags/3.6.0
6f3cff904185833677df7bcbbacc542780448786    refs/tags/3.6.1    
Daniels-MBP:testmeAPP daniel$ git submodule add https://github.com/Shopify/mobile-buy-sdk-ios.git     
fatal: not a git repository (or any of the parent directories): .git

Please help!

any input would be greatly appreciated!

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Dan.code
  • 431
  • 2
  • 14

1 Answers1

1

There should be additional error lines after

git submodule add git@github.com:Shopify/mobile-buy-sdk-ios.git

Make sure first that you do have access to the remote repository with:

git ls-remote git@github.com:Shopify/mobile-buy-sdk-ios.git

Try also, for testing, the HTTPS URL:

git submodule add https://github.com/Shopify/mobile-buy-sdk-ios.git

That should avoid the SSH error:

git@github.com: Permission denied (publickey). 
fatal: Could not read from remote repository. 
Please make sure you have the correct access rights and the repository exists.

If you do want to use an SSH URL, make sure your public SSH key ~/.ssh/id_rsa.pub content is registered to your account first.


The exact error message was:

fatal: not a git repository (or any of the parent directories): .git .  

That simply means the current folder (in which you are trying to add a submodule, any submodule) is not itself a Git repository!

You should create one first:

 cd desktop/testmeAPP
 git add .
 git commit -m "First commit for testmeAPP"

See also "Using Git with an existing Xcode project"

Then try your git submodule add command again.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • `Daniels-MBP:testmeAPP daniel$ git ls-remote git@github.com:Shopify/mobile-buy-sdk-ios.git Warning: Permanently added the RSA host key for IP address '13.236.229.21' to the list of known hosts. git@github.com: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.` How do I get access? – Dan.code Oct 14 '19 at 04:53
  • @Dan.code I have updated the answer. Using HTTPS in your case would be simpler. – VonC Oct 14 '19 at 04:57
  • after creating a SSH and linking it to my github account. Ive checked to see if i have access `git ls-remote git@github.com:Shopify/mobile-buy-sdk-ios.git`, I get a bunch of numbers back (small snippet) `6f3cff904185833677df7bcbbacc542780448786 HEAD 0455a9cc8c7d269ddc186f5923602251b73b346a refs/heads/develop 6f3cff904185833677df7bcbbacc542780448786 refs/heads/master` however it still says `not a git repository` when typing `git submodule add git@github.com:Shopify/mobile-buy-sdk-ios.git` – Dan.code Oct 14 '19 at 06:33
  • I got the message `You've successfully authenticated, but GitHub does not provide shell access.` after setting up my SSH – Dan.code Oct 14 '19 at 06:37
  • @Dan.code both of your comments show that your SSH setup is working well. The "bunch of numbers" are the SHA1 of the different remote branches HEADs. If the SSH URL is still not working, can you try with the HTTPS URL, for testing? – VonC Oct 14 '19 at 06:57
  • the HTTPS URL `git submodule add https://github.com/Shopify/mobile-buy-sdk-ios.git` comes back with the same error:: `not a git repository` – Dan.code Oct 14 '19 at 07:14
  • @Dan.code Can you edit your question with the path where you are typing the command, and the full complete error message? (as in "copy-paste everything, the path, the command and the complete output") – VonC Oct 14 '19 at 07:15
  • @Dan.code Thank you. I have edited my answer accordingly. – VonC Oct 14 '19 at 07:28
  • That works now, thank you for your answer and explanation. I really appreciate it! – Dan.code Oct 14 '19 at 07:37