Git Submodule - Permission Denied

后端 未结 9 1259
长发绾君心
长发绾君心 2021-02-03 20:44

I am not able to clone the submodule existing within my private git repository. I do have access to entire repository,

Have used the below commands but dint work, pleas

相关标签:
9条回答
  • 2021-02-03 21:18

    I had the same problem. I removed the entry from .gitmodules and executed git submodule init; git submodule update then I removed the entry from the file system and executed git submodule update --remote and it started downloading the submodule again.

    0 讨论(0)
  • 2021-02-03 21:19

    I had this issue. In my case, the public key (~/.ssh/id_rsa.pub) wasn't set up on the server properly.

    Ensure you're getting all the submodules:

    Reference: Git update submodules recursively

    # This must be called twice. Once for new and once for existing submodules.
    git submodule update --init --recursive
    git submodule update --recursive
    

    To diagnose permission issues with your key:

    • Access: Ensure that either: (1) you're cloning a public repo or (2) it's private, but your github account has access.
    • Diagnose with ssh -vT git@github.com. Ensure the key you set up is listed there. For more help on permissions issues, follow this guide: https://help.github.com/articles/error-permission-denied-publickey/
    • Adding a key to Github: https://help.github.com/articles/generating-ssh-keys/

    To check details of your submodules

    • Open .gitmodules in the project root folder and ensure things look okay. As recommended by @VonC try cloning them in a separate folder.
    • You might want to switch submodules from using SSH to HTTPS. That will let you type a username and password. But that can cause issues with your teammates and build automation. Speak to them first.
    0 讨论(0)
  • 2021-02-03 21:19

    i had created a submodule in error by using git init in a parent folder AND in its subfolder. Just removed the .git folder and started over with git init in the correct parent folder.

    0 讨论(0)
  • 2021-02-03 21:27

    I was facing the same issue. The problem was on your github repo , you might be using some old ssh key.

    You need to update the current ssh key.

    Steps involved are:
    
    1. vim ~/.ssh/id_rsa.pub
    2. copy the ssh key
    3. Go to the github settings
    4. Select the option ssh keys
    5. Remove the old ssh keys not used anymore.
    6. Add a new ssh key.
    7. Try running the "git submodule update --recursive"
    

    This worked for me !!

    0 讨论(0)
  • 2021-02-03 21:37

    In my case the issue was caused by console which did not ask me for a password. Solution was to change the console from CMDER to Gitbash. When I used CMDER it does not show the password window which caused this access denied issue.

    0 讨论(0)
  • 2021-02-03 21:42
    • On Windows:

    In my case, it was complaining about the same issue when I was using a regular command line (Git CMD). Then I tried with Git Bash and no issue no more.

    0 讨论(0)
提交回复
热议问题