ssh -T git@github.com

1
2
git config --global user.name "usernme"
git config --global user.email "emailName"

Quick setup

Get started by creating a new file or uploading an existing file. We recommend every repository include a READMELICENSE, and .gitignore.

…or create a new repository on the command line

1
2
3
4
5
6
7
echo "# whatever you write" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/***/***.git
git push -u origin main

…or push an existing repository from the command line

1
2
3
git remote add origin https://github.com/***/***.git
git branch -M main
git push -u origin main

…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.
import https://github.com/`username/repo`/import

ssh -v git@github.com

1
2
3
4
5
6
7
8
9
10
11
12
13
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/Tree/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/Tree/.ssh/id_dsa
debug1: Trying private key: /home/Tree/.ssh/id_ecdsa
debug1: Trying private key: /home/Tree/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/Tree/.ssh/id_ed25519
debug1: Trying private key: /home/Tree/.ssh/id_ed25519_sk
debug1: Trying private key: /home/Tree/.ssh/id_xmss
debug1: No more authentication methods to try.
git@github.com: Permission denied (publickey).

解决办法:
1、修改私钥名称为默认:id_rsa
2、指定私钥名称
vim ~/.ssh/config

1
2
3
4
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa_github
User git