github - 便携版git(即安装在U盘上的版本)如何设置ssh私钥?

 _大盗坂崎由莉nyS 发布于 2022-10-25 09:52

便携版的git是即插即用的,可以在任意一台没有安装git的电脑上使用。如果采用和桌面版git相同的方法设置ssh私钥,是无法正常使用ssh访问github远程仓库的,即使我将私钥保存在U盘上。下面是错误信息:

The authenticity of host 'github.com (192.30.253.112)' can't be
established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of know
n hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我想知道如何在便携版的git如何设置ssh私钥才能保证我正常连接远程仓库。

1 个回答
  • 我根据git移动版中的readme文件找到了配置方法。其实方法很简单,配置步骤和桌面版git配置ssh-key的方法基本一样,只是其中选择密钥的存放路径这一步有所不同——不要回车使用默认路径,要将路径改为U盘中移动版git的路径(如g:\\git_portable\\.ssh)。然后,每次使用git(移动版)的时候,先使用export HOME=g:\\git_portable临时修改HOME环境变量,其中后面的移动版git的安装路径要根据你的实际情况设置。
    这样你就可以像在桌面版git中一样,来使用ssh来访问你的github远程仓库了。
    注意,不要忽略上面路径中的的双斜杠\\。

    2022-10-26 23:06 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有