admin管理员组

文章数量:1532245

重新装了系统,重装之前我拷贝了git的.ssh文件,但是忘了拷贝.gitconfig文件。本文要介绍的是用原来的.ssh(包括秘钥和)怎么再次配置Git。先打开Git Bash。

1.将.ssh放置到git的当前目录下,如我的当前目录是

C:\Users\wgzhang

2.设置Git的user name和email:

<span style="font-size:14px;">$ git config --global user.name "wgzhang163512"</span>
<span style="font-size:14px;">$ git config --global user.email "wgzhang163512@gmail"</span>
<span style="font-size:18px;">这个设置用原来的设置即可。</span>
<span style="font-size:18px;"><span style="line-height: 17px;">这样就会在Git的当前目录生成.gitconfig文件,文件中的内容是</span></span><pre name="code" class="plain" style="font-size:18px; line-height: 17px;">[user]
	email = wgzhang163512@gmail
	name = wgzhang163512
3. 查看是否已经有了ssh密钥:cd ~/.ssh
由于我们已经放置了文件,所以,可以进入该目录

 
<span style="font-family:Helvetica, Arial, sans-serif;"><span style="font-size: 14px; line-height: 26px;">
4.测试当前的Key能否正常工作:</span></span>
<span style="font-family:Helvetica, Arial, sans-serif;"><span style="font-size: 14px; line-height: 26px;"></span></span><pre style="white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 25px;"><span class="pln">ssh </span><span class="pun" style="color: rgb(102, 102, 0);">-</span><span class="pln">T git@github</span><span class="pun" style="color: rgb(102, 102, 0);">.</span><span class="pln">com</span>

 
<span style="font-family:Helvetica, Arial, sans-serif;"><span style="font-size: 14px; line-height: 26px;">出现上图结果,说明我们再次配置Git成功。</span></span>
<span style="font-size:18px;">
</span>

本文标签: 重装系统GitSSH