在 Windows 下使用 Git

如果只在git bash 上配置 Git 并使用 SSH 授权,Git 会在HOME 环境指向的目录中查找 SSH 密钥。该变量总是由git bash 设置。

不过,Windows 命令提示符通常不会设置该变量。在 Windows 命令提示符下运行 Git 时,它会在安装目录下查找 SSH 密钥,因此授权会失败。

你可以通过Qt Creator 设置HOME 环境变量。转到 "偏好设置" >Version Control >Git ,然后选择Set "HOME" environment variable 。运行 Git 可执行文件时,HOME 会被设置为%HOMEDRIVE%%HOMEPATH% ,授权也会像git bash 一样生效。

版本控制偏好设置中的 Git 选项卡

另请参阅 如何使用 Git》、《比较文件》、《设置版本控制系统》和《版本控制系统》。

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.