最近换了一个新的电脑,在新电脑中提交代码什么的肯定提交不上去,在这总结一下,万一下次又换新电脑了呢,哈哈,话不多说,开始:

1、首先需要我在git重新设置一下身份的名字和邮箱

命令:

git config --global user.name "yourname"

git config --global user.email“[email protected]"

(就是下图红色的地方)

新设备上使用 git

 2:删除.ssh文件夹下的known_hosts(直接删除就行)

3、git输入命令

$ ssh-****** -t rsa -C "[email protected]"(上面那个邮箱地址)

接着出现:

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):

请直接按下回车

然后系统会自动在.ssh文件夹下生成两个文件,id_rsa和id_rsa.pub,用记事本打开id_rsa.pub

将全部的内容复制

4:打开git,登陆你的账户,设置SSH

 

新设备上使用 git

按图中所说然后add key

5、在git中继续输入命令

ssh -T [email protected]

出现对话框,输入  yes  回车  ,然后应该可以了,退出git,重新使用命令试试看。

 

 

 

相关文章:

  • 2021-07-29
  • 2021-12-29
  • 2021-09-21
  • 2021-08-12
  • 2022-02-07
  • 2021-11-19
  • 2021-04-03
猜你喜欢
  • 2021-06-13
  • 2021-05-21
  • 2021-07-22
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2022-01-13
相关资源
相似解决方案