# fetchcontent not prompting for ssh password on powershell

**URL:** https://discourse.cmake.org/t/fetchcontent-not-prompting-for-ssh-password-on-powershell/14296
**Category:** Usage
**Tags:** os:windows
**Created:** [June 30, 2025, 8:17am UTC](https://discourse.cmake.org/t/fetchcontent-not-prompting-for-ssh-password-on-powershell/14296 "2025-06-30T08:17:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ChipsUndCola](https://discourse.cmake.org/user_avatar/discourse.cmake.org/chipsundcola/32/5639_2.png) [@ChipsUndCola](https://discourse.cmake.org/u/ChipsUndCola)
#### Post date: [June 30, 2025, 8:17am UTC](https://discourse.cmake.org/t/fetchcontent-not-prompting-for-ssh-password-on-powershell/14296/1 "2025-06-30T08:17:52Z")

</div>

Hi,  
I use cpmaddpackage() to add a protected git repo to my project.  
I use a password protected ssh key to access the git repo.  
Cpmaddpackage is a wrapper for fetchcontent.

When I run  
`cmake --preset mypreset` on Git Bash, everything runs smoothly and the repo is cloned nicely.  
However when I tried to configure the project through the VS Code Plugin CMake Tools, the clone fails without an expressive error message.  
I started blaming the plugin, but after playing around a little bit I realized that the problem also occurs outside of VS Code, when I run `cmake --preset mypreset` in powershell.

By configuring git to use ssh in verbose mode, I finally got a sensible error message:  
On powershell the clone fails due to not finding “/dev/tty” where I would be prompted for the ssh password.

 ![image](https://discourse.cmake.org/uploads/default/original/2X/b/bf5ec118c5928dd0b7ada3752b9338e9057278bd.png)

I can only avoid this by using git bash, which doesnt integrate well into the VS Code Plugin or by using a ssh key that is not password protected, which is not a sustainable option.

Please let me know if anybody encountered a similar bug and was able to solve it

There is a bug on the “VSCode Cmake Tools” repo that discusses this, but i dont think the plugin cannot solve the problem when the issue might be in cmake itself?

> <https://github.com/microsoft/vscode-cmake-tools/issues/3439>
>
> \### Brief Issue Summary
> 
> When configuring a project using the CMake tools extens…ion and CMakePresets there is no password prompt for git repositories cloned by FetchContent.
> When running the same cmake presets from the terminal directly, there is a prompt which asks for the password for the private repository.
> 
> Since the CMake tools extension just uses the "output" window there will probably be no way to get this working, right?
> 
> Best regards, Manuel
> 
> \### CMake Tools Diagnostics
> 
> \_No response\_
> 
> \### Debug Log
> 
> \_No response\_
> 
> \### Additional Information
> 
> \_No response\_

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [June 30, 2025, 10:21pm UTC](https://discourse.cmake.org/t/fetchcontent-not-prompting-for-ssh-password-on-powershell/14296/2 "2025-06-30T22:21:28Z")

</div>

In order to prompt for a password, you would need to use the `USES_TERMINAL_DOWNLOAD`, `USES_TERMINAL_UPDATE` and possibly other `USES_TERMINAL_...` keywords. Each one should be followed by a true value (TRUE, YES, 1, …). This gives CMake access to the terminal to ask for a password. From there, it is up to whatever is invoking CMake to ensure a terminal is actually available. CMake can’t do much if a suitable terminal isn’t provided.

In general though, I would strongly recommend not relying on providing a password as input. Instead, try to use something like ssh-agent so that CMake can run non-interactively.
