1、在gitee中建立仓库

2、在命令行里输入git仓库中提示的代码

git config --global user.name "用户名"
git config --global user.email "邮箱"


git init 
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@gitee.com:用户名/库名.git
git push -u origin "master"

3、然后上传代码 会遇到报错

git push -u origin "master"
git@gitee.com: Permission denied (publickey).
 
Please make sure you have the correct access rights
and the repository exist

按照这个教程去解决
https://blog.csdn.net/weixin_50986057/article/details/131700607

ssh-keygen -t rsa -C  "这里是你自己注册Gitee的邮箱@xxx.com"

遇到这三条要输入的地方,全部直接回车

Enter file in which to save the key (/home/devbox/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again:

  • 终端执行如下代码,查看public key。
cat ~/.ssh/id_rsa.pub

终端会显示很长公钥
然后把公钥输入gitee例的个人设置的ssh公钥里
在这里插入图片描述
然后回到终端输入

ssh -T git@gitee.com

会显示成功

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐