Loading... ### **设置 Git 用户** - 先在终端执行一下 `git config --global --list`,看看当前设备的 git 有没有设置好相关的用户名跟邮箱。 有的话就会正常显示 ``` user.name=Your Name user.email=your-name@example.com ``` - 如果没有的话,就会出现类似这种错误 ``` fatal: unable to **read** config **file** **'\~/.gitconfig'**: No such **file** or directory ``` - 既然没有那就设置一下 ``` git config --global user.name "Your Name" git config --global user.email "Your Email" ``` - 设置完成后要想确认一下,就重新执行 ``` git config --global --list ``` ### **生成 SSH Key** - 这个就比较容易,直接执行这条命令,主要是设置一下邮箱地址 ``` ssh-keygen -t rsa -C "your-email-address" ``` - 一路回车就行,一般会显示下面这些内容,具体内容以自己的系统为准 ``` Generating public/private rsa key pair. Enter file in which to save the key (~/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in ~/.ssh/id_rsa. Your public key has been saved in ~/.ssh/id_rsa.pub. The key fingerprint is: SHA256:IuTZyVphdJVuRBBYBjCYtCTD1rJcgumXe0oXdErnUeo limitliu@qq.com The key's randomart image is: +---[RSA 2048]----+ |=o+oo.o+B*o. | |oOo+ =.*. o | |+ * = B..o | | + = B.+ o | | . = BES. | | o * . | | . = | | . | | | +----[SHA256]-----+ ``` - 生成后把内容拷贝到自己的剪贴板,public key 文件生成在哪可以看上面执行后的结果,里面有对应文件路径,我这里生成得文件是在 `~/.ssh/id_rsa.pub` 这个路径,**Mac** 可以直接这样执行这条命令来复制 ``` 生成后把内容拷贝到自己的剪贴板,public key 文件生成在哪可以看上面执行后的结果,里面有对应文件路径,我这里生成得文件是在 `~/.ssh/id_rsa.pub` 这个路径,**Mac** 可以直接这样执行这条命令来复制 ``` - 之后就可以在需要使用的地方直接粘贴了 END 最后修改:2023 年 09 月 04 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 2 如果觉得我的文章对你有用,请随意赞赏 下一篇 上一篇 1 条评论 Loading... 周某 September 4th, 2023 at 03:38 pm 你喜欢爸爸还是喜欢妈妈 回复 发表评论 取消回复 使用cookie技术保留您的个人信息以便您下次快速评论,继续评论表示您已同意该条款 评论 * 私密评论 名称 * 🎲 邮箱 * 地址 发表评论 提交中...
1 条评论
你喜欢爸爸还是喜欢妈妈