Skip to content

Commit 5f8b22a

Browse files
author
Administrator
committed
优化检查输入,和git地址修改打印
1 parent 39a8e42 commit 5f8b22a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

gen_ssh-key.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22
email=$1
3+
#检查输入
4+
if [ -z "$email" ]; then
5+
echo "❌ 请提供电子邮件地址作为参数。"
6+
echo "用法: ./gen_ssh-key.sh <email>"
7+
exit 1
8+
fi
39
ssh-keygen -t ed25519 -C "$email" -N ""
410
eval "$(ssh-agent -s)"
511
ssh-add ~/.ssh/id_ed25519
@@ -10,4 +16,7 @@ echo "✅ 请将上面的公钥添加到 GitHub/GitLab/Bitbucket 等代码托管
1016
echo https://github.com/settings/keys
1117

1218
echo "✅ 修改远程仓库地址为 SSH 地址 [email protected]:linjonh/shellscript-install.git"
13-
git remote set-url origin [email protected]:linjonh/shellscript-install.git
19+
git remote -v
20+
echo "修改后的远程仓库地址为:"
21+
git remote set-url origin [email protected]:linjonh/shellscript-install.git
22+
git remote -v

0 commit comments

Comments
 (0)