Skip to content

Commit 8d2fd73

Browse files
authored
Create ssh.sh
1 parent c150f6f commit 8d2fd73

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Cachyos/ssh.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# shellcheck enable=all shell=bash source-path=SCRIPTDIR
3+
set -euo pipefail
4+
shopt -s nullglob globstar
5+
6+
EMAIL="${GIT_AUTHOR_EMAIL:-$(git config get user.email)}"
7+
8+
mkdir -p ~/.ssh && chmod -R 700 ~/.ssh
9+
ssh-keygen -t ed25519 -C "$EMAIL" -f ~/.ssh/id_git -q
10+
eval "$(ssh-agent -s)" || eval (ssh-agent -cs)
11+
ssh-add ~/.ssh/id_git
12+
13+
cat ~/.ssh/id_git.pub | wl-copy -r || cat ~/.ssh/id_git.pub | xclip -sel clipboard
14+
xdg-open
15+
echo "copy to to https://github.com/settings/keys and https://gitlab.com/-/user_settings/ssh_keys"
16+
17+
ssh-keyscan -H github.com gitlab.com >>~/.ssh/known_hosts
18+
19+
echo "Test GitHub connection"
20+
21+
echo "Test GitLab connection"
22+

0 commit comments

Comments
 (0)