管理 Git 身份和配置文件
配置文件是提交的名称和电子邮件,以及可选的签名密钥和 SSH 命令,您可以在它们之间进行切换。默认情况下,它是 Passed to each git command GitTree 运行,因此 ~/.gitconfig 永远不会更改,并且存储库自己的名称或电子邮件仍然有效; Written to ~/.gitconfig 使每个 git 工具都使用它。
免费使用 GitTree:登录后的所有本地 Git 功能。
开始之前
- 没有什么。如果没有配置文件,您的 git 配置将决定您提交的身份。
在哪里可以找到它
- 首选项 › Profiles。
| 行动 | macOS | Windows 和 Linux |
|---|---|---|
| 偏好设置 | ⌘, | Ctrl+, |
步骤
创建个人资料
按 New profile,输入 Profile name、Name for commits (user.name) 和 Email for commits (user.email),还可以选择输入 Signing key 和 SSH command,例如
ssh -i ~/.ssh/work_key。按 Create profile。选择它如何到达 git
在 How the identity reaches git 下,保留 Passed to each git command 或选择 Written to ~/.gitconfig。
转变
按 Switch to this profile。 GitTree 表示 Switched to the profile “…”. 并且新提交使用它。
预期结果
您的提交带有您所在配置文件的身份。
一个存储库,自己的身份
在 Repo-Specific Preferences、Name for commits 和 Email for commits 中,仅为该存储库设置 user.name 和 user.email。连接的帐户可以填写电子邮件:Use an Account’s Address… 仅列出提供商返回的地址。
如果出现问题
“当前的配置文件无法删除。请先切换到另一个配置文件。”
切换到另一个配置文件,然后 Delete… 这个配置文件。保留其文件的备份。
问题
终端是否使用我的 GitTree 配置文件?
对于 Passed to each git command,只有 git 命令 GitTree 运行时才使用它;终端和其他 git 工具继续使用您的 git 配置。