JHBuild 使用 git 协议而不是 https 来克隆文件。我正在一个代理环境中工作,它可以防止使用 git 协议进行克隆。
示例 gnome repo 的 git url:git://git.gnome.org/gnome-common
示例 gnome repo 的 http url: http : //git.gnome.org/browse/gnome-common。
当 JHBuild 执行克隆命令时,有什么方法可以自动将 git url 转换为 https 格式。
gnome 模块集将 git.gnome.org 定义为使用 git:// 但这可以在 jhbuildrc 文件中更改。
在 jhbuildrc 中添加以下行。
repos['git.gnome.org'] = ' http://git.gnome.org/browse/ '
该文件通常存在于 ~/.config 中。如果不存在,则创建 jhbuildrc 文件。
如果git://
由于代理或防火墙而无法使用 url 克隆存储库,这里有一个小 git 配置,http://
即使您输入git://
URL,也会强制 git 使用。
git config --global url."http://".insteadOf git://
使用此命令,它将在您中添加以下行.gitconfig
:
[url "http://"]
insteadOf = git://
这样,您不必关心使用git://
或http://
在克隆 repo 时,两个 url 都可以使用。
也许是一个众所周知的调整,但最近发现它......