Github配置SSH key

https://blog.csdn.net/weixin_42310154/article/details/118340458

普通配置上面这个链接里的大佬已经讲完了,只是我发现我设了passphrase他没设置,这里补充记录一下设置了passphrase后怎么只输一次密码(毕竟每次打开git都要输一次密码也挺烦的)

参考github官方文档https://docs.github.com/en/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases

1、找到git目录下的.bashrc文件

2、用记事本打开输入后保存

bash 复制代码
env=~/.ssh/agent.env

agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }

agent_start () {
    (umask 077; ssh-agent >| "$env")
    . "$env" >| /dev/null ; }

agent_load_env

# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2=agent not running
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)

if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
    agent_start
    ssh-add
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
    ssh-add
fi

unset env

3、打开git-bash就会要求输入passphrase,输入以后会提示Identity added,以后再打开就不用验证密码了


官方文档里还有重置密码、短时添加之类的命令,暂时用不到就没看,感兴趣的同学可以看看

相关推荐
单位圆的日常2 天前
FRP反向隧道实现异地SSH家用Linux
linux·运维·ssh·frp
tjl521314_212 天前
Git SSH Host Key Verification Failed 问题排查与解决
运维·git·ssh
Jurio.3 天前
Codex App SSH 远程开发教程:本地连接远程服务器项目
服务器·ssh·远程工作·codex
REDcker3 天前
GitHub SSH 连接失败排障实录
运维·ssh·github
洪恒远4 天前
Windows 配置 Gerrit SSH Key
运维·ssh
ITKEY_7 天前
iPad应用webssh tmux 前缀键持续时间短解决办法
ssh
Web3探索者14 天前
可视化服务器管理和传统命令行区别是什么?新手教程:Linux 运维到底该用图形界面还是 SSH 命令行?
linux·ssh
开发者联盟league21 天前
安装pnpm
ssh
2601_9618752421 天前
决战申论100题2026|最新|范文
linux·容器·centos·debian·ssh·fabric·vagrant
小小小花儿22 天前
SSH密钥配置(免密连接远程服务器)
服务器·ssh