# Letting the user choose a git clone protocol

**URL:** https://discourse.cmake.org/t/letting-the-user-choose-a-git-clone-protocol/3572
**Category:** Usage
**Created:** [June 15, 2021, 3:43pm UTC](https://discourse.cmake.org/t/letting-the-user-choose-a-git-clone-protocol/3572 "2021-06-15T15:43:26Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![pscl](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/5f9b8f/32.png) [@pscl](https://discourse.cmake.org/u/pscl)
#### Post date: [June 15, 2021, 3:43pm UTC](https://discourse.cmake.org/t/letting-the-user-choose-a-git-clone-protocol/3572/1 "2021-06-15T15:43:26Z")

</div>

I am trying to use FetchContent to replace git submodules pointing to other local projects. One problem I have is that the protocol provided to FetchContent is fixed and forced to the user. For example, If I provide a SSH link to a subproject, a colleague that has not set her SSH keys will hit an error during configuration. I do not have this issue with submodules.

Is there a known pattern to solve this problem?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 15, 2021, 4:26pm UTC](https://discourse.cmake.org/t/letting-the-user-choose-a-git-clone-protocol/3572/2 "2021-06-15T16:26:17Z")

</div>

You could provide an option which switches the protocol. Alternatively, you can use the `insteadOf` feature of Git. [Here’s](https://www.oliverdavies.uk/blog/easier-git-repository-cloning-insteadof) a blog post about it. Basically, you set the URL as `someprefix:path/to/repo.git` and tell Git that a prefix of `someprefix:` should be replaced by `https://some.hosting.service/` or `ssh://git@some.hosting.service/` depending on local configuration.
