B
B
Blog
搜索文档…
⌃K

StartToGit

Steps

  1. 1.
    Download & Install Git
  2. 3.
    • 关于 SSH
    • 检查现有的 SSH 密钥
    • 生成新的 SSH 密钥并添加到 ssh-agent
    • 新增 SSH 密钥到 GitHub 账户
    • 测试 SSH 连接
    • 使用 SSH 密钥密码
  3. 4.
    Clone repo 并测试提交改动,验证提交通过,无需输入账号密码
    • modify file
    • git add .
    • git commit -m ""
    • git push

History log

[email protected] MINGW64 ~/Desktop
$ ls -al ~/.ssh
ls: cannot access '/c/Users/Guo/.ssh': No such file or directory
[email protected] MINGW64 ~/Desktop
$ ssh-keygen -t ed25519 -C "[email protected]"
Generating public/private ed25519 key pair.
Enter file in which to save the key (/c/Users/Guo/.ssh/id_ed25519):
Created directory '/c/Users/Guo/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Guo/.ssh/id_ed25519
Your public key has been saved in /c/Users/Guo/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:******************************************** [email protected]
The key's randomart image is:
+--[ED25519 256]--+
| ******|
| *******|
| ********|
| ********|
| *********|
| *********|
| ********|
| ***|
| **|
+----[SHA256]-----+
[email protected] MINGW64 ~/Desktop
$ eval 'ssh-agent -s'
SSH_AUTH_SOCK=/tmp/ssh-tLCshDnx4NI5/agent.784; export SSH_AUTH_SOCK;
SSH_AGENT_PID=785; export SSH_AGENT_PID;
echo Agent pid 785;
[email protected] MINGW64 ~/Desktop
$ ssh-add ~/.ssh/id_ed25519
Could not open a connection to your authentication agent.
# Check and confirm Github client has been installed
[email protected] MINGW64 ~/Desktop
$ ssh-add ~/.ssh/id_ed25519
Identity added: /c/Users/Guo/.ssh/id_ed25519 ([email protected])
[email protected] MINGW64 ~/Desktop
$ clip < ~/.ssh/id_ed25519.pub
[email protected] MINGW64 ~/Desktop
The authenticity of host 'github.com (52.74.223.119)' can't be established.
RSA key fingerprint is SHA256:*******************************************.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts.
Hi gyx8899! You've successfully authenticated, but GitHub does not provide shell access.

Problems

  • Could not open a connection to your authentication agent.
# Start ssh-agent fix auth issue
ssh-agent bash