Usage environment
Ubuntu-PC, github/gitee
SSH key
shell protocol (Secure Shell Protocol --> SSH) to connect to GitHub. SSH can provide a secure channel in an insecure network.
Check if SSH key exists
ls -l ~/.ssh
View git configuration information
git config -l
Generate SSH key if not available
ssh-keygen -t rsa -C "your_email@example"
Press Enter all the way, no password required
GIT add key
copy key
cat ~/.ssh/id_rsa.pub
Add key
Go to your personal git homepage, click on your personal avatar icon, and enter Settings.
The personal homepage setting interface will appear. Click the SSH and GPG keys option and copy the content of id_rsa.pub to the SSH keys option.
Where Titel fills in the description tag.
Finally, click Add SSH Key to complete.
Test SSH connection
ssh -T [email protected]
The following content will appear
> The authenticity of host 'github.com (IP ADDRESS)' can't be established.
> RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
> Are you sure you want to continue connecting (yes/no)?
If there is an error or if you enter the password repeatedly, it is an error.
Then test whether SSH on the HTTPS port is feasible
$ ssh -T -p 443 [email protected]
If that doesn't work, permission to proceed is denied .
if appears
You've successfully authenticated, but GitHub does not provide shell access.
You need to enable SSH connections over HTTPS
In ~/.ssh/config, if there is no such file, create a config file without a suffix.
Host github.com
Hostname ssh.github.com
Port 443
User git
final test
ssh -T [email protected]
Download git repository
Select the ssh download link and have fun playing!
other problems
Problem 1 Description:
Solve the specific method of no matching host key type found. Their offer: ssh-rsa error message.
Add some configurations to the config configuration file.
Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
save it.
Description of problem 2:
Git missing Change-Id in commit message footer Solution:
Just execute the following process
gitdir=$(git rev-parse --git-dir);
# 将xxxxx@xxxx 替换成相应用户名、服务器即可(该命令从服务器拷贝commit-msg文件)
scp -p -P 29418 xxxxx@xxxx:hooks/commit-msg ${gitdir}/hooks/
# 再提交一次即可生成change-id
git commit --amend