我有作業和個人回購,想在同一臺機器上使用各自的 git 帳戶在兩者之間切換。我已經在作業存盤庫上設定了 GPG 簽名提交,我想在個人存盤庫上設定 ssh 提交并能夠在兩者之間切換。
但我不斷收到此錯誤
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
我有一個像這樣的檔案夾結構:
root
|_ .gitconfig
|_ .ssh
|_config
|_mypersonal (ssh key)
|_mypersonal.pub (ssh key)
|_ Desktop
|_ repos (work)
|_ .gitconfig.work
|_ workRepos...
|_ myrepos (personal)
|_ .gitconfig.pers
|_ personalRepos...
這些是上面列出的 git 檔案:
# .gitconfig
[includeIf "gitdir:~/Desktop/myrepos/"]
path = ~/Desktop/myrepos/.gitconfig-pers
[includeIf "gitdir:~/Desktop/repos/"]
path = ~/Desktop/repos/.gitconfig-work
[core]
excludesfile = ~/.gitignore
#config
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/mypersonal
#.gitconfig.work
[user]
email = [email protected]
name = Me Work
signingkey = *********************************
[commit]
gpgsign = true
#.gitconfig.pers
[user]
email = [email protected]
name = Me Personal
[github]
user = “githubUserName”
[core]
sshCommand = “ssh -i ~/.ssh/mypersonal”
uj5u.com熱心網友回復:
仔細檢查全域配置中宣告的路徑,然后使用:
git config --list --show-origin --show-scope
在每個存盤庫中。
您可以將您的設定與本要點中描述的程序進行比較。
正如OP C0deJack在評論中提到的那樣:
- 檔案名應該是
.gitconfig-pers- 雙引號應該是
"而不是”
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/477764.html
上一篇:git-add和git-diff使用不同的差異工具?
下一篇:未跟蹤的git子模塊
