使用git上传代码

发布时间 2023-05-31 00:37:23作者: seekwhale13

使用git上传代码

创建公钥与github连接

1.打开Git Bash,输入以下命令,注意换成自己邮箱

$ ssh-keygen -t ed25519 -C "your_email@example.com"

2.密钥位置
当系统提示“Enter a file in which to save the key(输入要保存密钥的文件)”时,可以按 Enter 键接受默认文件位置,也可手动修改位置。

> Enter a file in which to save the key (/c/Users/YOU/.ssh/id_ALGORITHM):[Press enter]

3.一直回车后生成密钥
image

4.将密钥添加至github
点击进入设置
image

点击SSH and GPG keys
image

将id_ed25519.pub文件内的内容粘贴入框内
image

测试连接,输入以下命令

ssh -T git@github.com

连接成功后提示

Hi seekwhale13! You've successfully authenticated, but GitHub does not provide shell access.