简体   繁体   中英

Inconsistent git submodule remote url

I have a git submodule:

$ cd zathura
$ git remote get-url origin
ssh://git@github.com/pwmt/zathura.git
$ cd ..

But inside .git/config

[submodule "zathura"]
    url = https://github.com/pwmt/zathura.git

And inside .gitmodules

[submodule "zathura"]
    path = zathura
    url = https://github.com/pwmt/zathura.git
    ignore = dirty

Questions

Why the Remote urls are inconsistent (a mixture of https and ssh)? Is this valid? Or is it due to some mistake that I might have done? How can I have consistent remote url and which url is used by git?

From the comments of Git Submodules equivalent for url.insteadof , this should work:

git -c url.https://github.com/.insteadOf=git@github.com: submodule update --init --recursive

That way, you can test the effect of an insteadOf directive, and make sure HTTPS is used everywhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM