git 命令理解的 URL 可以是 HTTPS 或 SSH 格式。
在 CMake 中,可以使用 git 命令理解的任何 URLExternalProject_Add
来指定指定的URL。GIT_REPOSITORY
必须提供使用 HTTPS 用户凭据才能“克隆”私有存储库。因为ExternalProject_Add
,这种机制在使用时HTTP_USERNAME
以形式存在。HTTP_PASSWORD
DOWNLOAD_COMMAND
因为GIT_REPOSITORY
似乎没有这样的方法。使用时:
include( ExternalProject )
ExternalProject_Add(test
GIT_REPOSITORY git@github.com:myuser/myprivaterepo.git
GIT_REMOTE_NAME origin
)
在私有存储库上给出以下错误:
fatal: could not read Username for 'https://github.com': No such device or address
问题
GIT_REPOSITORY
使用 HTTPS 连接到私有存储库时,如何让 CMake 请求密码ExternalProject_Add
?