git linux git push到码云

  • 进入https://gitee.com/profile 查看自己的账号和邮箱,记到记事本下来,下面会用到。
  • 打开Git输入命令git config –global user.name “yourname”回车
    git config –global user.email“your@email.com”回车
    这里写图片描述
    $ ssh-keygen -t rsa -C “your@email.com”(请填你设置的邮箱地址)回车

接着出现:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):

无视这些请继续直接按下回车

  • 直到出现
    The key’s randomart image is:
    +—[RSA 2048]—-+
    | ==++. . |
    | . ++.o . .|
    | ..o++Oo |
    +—-[SHA256]—–+这里写图片描述
    这样的
  • 之后打开提示的目录下记事本打开id_rsa.pub,复制里面内容。
  • 进入自己的账号 https://gitee.com/profile/sshkeys 点击 SSH公钥
  •  


  • 复制的内容粘贴到Key里,Title可以不写,亲测。

     验证:$ ssh -T git@gitee.com回车 测试

注意:在生成密钥的时候会出现 Enter passphrase (empty for no passphrase),这一步直接输入回车 不要输入密码

原文地址:https://www.cnblogs.com/wyj168/p/8145711.html