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 = wgzhang1635123. 查看是否已经有了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>
版权声明:本文标题:重装系统后,用原来的git的.ssh重新进行配置 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1725601444a1032418.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论