xgqfrms / git

git all in one
https://git.xgqfrms.xyz
MIT License
2 stars 1 forks source link

git & SSH keys #11

Open xgqfrms opened 4 years ago

xgqfrms commented 4 years ago

git & SSH keys

github & gitlab

https://github.com/settings/keys

$ ls -al ~/.ssh                                     
total 24
drwx------   5 xgqfrms-mbp  staff   160 Dec 24 23:20 .
drwxr-xr-x+ 75 xgqfrms-mbp  staff  2400 Dec 24 23:20 ..
-rw-------   1 xgqfrms-mbp  staff  3389 Dec 24 23:20 id_rsa
-rw-r--r--   1 xgqfrms-mbp  staff   745 Dec 24 23:20 id_rsa.pub

$ pwd
/Users/xgqfrms-mbp

$  cd .ssh
$ .ssh ls

$ cat id_rsa.pub
# copy SSH key

image

xgqfrms commented 4 years ago

https://help.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

xgqfrms commented 4 years ago

SSH key

https://www.cnblogs.com/xgqfrms/p/5880270.html

xgqfrms commented 4 years ago

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

# save path

$ 
xgqfrms commented 4 years ago

http://git.gitlab.com/profile/keys

xgqfrms commented 4 years ago

image

Copy your public SSH key to the clipboard by using one of the commands below depending on your Operating System: macOS:

$ pbcopy < ~/.ssh/id_ed25519.pub

WSL / GNU/Linux (requires the xclip package):

$ xclip -sel clip < ~/.ssh/id_ed25519.pub

Git Bash on Windows:

$ cat ~/.ssh/id_ed25519.pub | clip

You can also open the key in a graphical editor and copy it from there, but be careful not to accidentally change anything. NOTE: Note: If you opted to create an RSA key, the name might differ.