Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submodule config results in mixed protocols after cloning #10265

Closed
ErisDS opened this issue Dec 10, 2018 · 2 comments
Closed

Submodule config results in mixed protocols after cloning #10265

ErisDS opened this issue Dec 10, 2018 · 2 comments
Assignees

Comments

@ErisDS
Copy link
Member

ErisDS commented Dec 10, 2018

We're having some difficulty documenting the best way to setup the Ghost repo & submodules for contributing, as cloning the top-level repo results in a mix of https and ssl URLs in the git config for submodules.

What we want is for there to be a clear and minimal set of commands that result in a correctly setup environment. This environment should be optimised for contributing, not for installing Ghost - which should use the CLI.

The current setup is using https:

[submodule "content/themes/casper"]
	path = content/themes/casper
	url = https://github.com/TryGhost/Casper.git
[submodule "core/client"]
	path = core/client
	url = https://github.com/TryGhost/Ghost-Admin.git

Cloning works reliably this way, but when pushing, git checks all remotes and will prompt you for a password, meaning you need to do quite a lot to get all of the remotes setup correctly.

There appear to be 3 potential solutions:

Option 1. Use Git SSH

[submodule "content/themes/casper"]
	path = content/themes/casper
	url = git@github.com:TryGhost/Casper.git
[submodule "core/client"]
	path = core/client
	url = git@github.com:TryGhost/Ghost-Admin.git

Option 2. Full relative URLs

[submodule "content/themes/casper"]
	path = content/themes/casper
	url = ../Casper.git
[submodule "core/client"]
	path = core/client
	url = ../Ghost-Admin.git

Option 3. Urls relative to the TryGhost org

[submodule "content/themes/casper"]
	path = content/themes/casper
	url = ../../TryGhost/Casper.git
[submodule "core/client"]
	path = core/client
	url = ../../TryGhost/Ghost-Admin.git

Relative urls means git uses whatever protocol is used on the top level clone for all the submodules.

Using fully relative URLs would open the option to cloning a fork, and automatically having all of the right remotes setup. However, you'd have to have all 3 repos forked to start.

Using URLs relative to the TryGhost org means the top-level protocol is honoured for submodules, and git uses the upstream TryGhost remotes for submodules, meaning you still have to add remotes if you want to work on Ghost-Admin or Casper.

Using git urls means the protocol and remotes are all fixed to use TryGhost with git. This mechanism should be the easiest to reason about, as it should always do the same thing.

Conclusion

For now, I suggest option 1 (git urls) because I think consistency is more important than flexibility, however if we still have problems balancing having a clear path to contributing with weirdness with ports and git not working on certain systems, options 2 and 3 are available to try out as well.

@ErisDS ErisDS added the tools label Dec 10, 2018
@ErisDS ErisDS self-assigned this Dec 10, 2018
@ErisDS ErisDS closed this as completed in 6499e11 Dec 10, 2018
@ErisDS
Copy link
Member Author

ErisDS commented Dec 10, 2018

OK that broke travis - trying option 3

Broken build: https://travis-ci.org/TryGhost/Ghost/jobs/466076267

git clone --depth=50 https://github.com/TryGhost/Ghost.git TryGhost/Ghost
cd TryGhost/Ghost
git fetch origin +refs/pull/10051/merge:
git checkout -qf FETCH_HEAD
git submodule update --init --recursive
Submodule 'content/themes/casper' (git@github.com:TryGhost/Casper.git) registered for path 'content/themes/casper'
Submodule 'core/client' (git@github.com:TryGhost/Ghost-Admin.git) registered for path 'core/client'
Cloning into '/home/travis/build/TryGhost/Ghost/content/themes/casper'...
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

@ErisDS ErisDS reopened this Dec 10, 2018
@ErisDS ErisDS closed this as completed in 31269de Dec 10, 2018
@randallb
Copy link

FYI this made my heroku push fail. I ended up switching to the HTTPS one and it seems fine now.

daniellockyer added a commit that referenced this issue Jul 25, 2022
refs #10265
refs TryGhost/Toolbox#354

- I seem to have regressed the referenced Ghost issue during the
  conversion to a monorepo
- this puts the url paths back to relative URLs so it uses whatever
  protocol the Ghost repo was cloned with
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants