- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
.gitconfig :
[user]
name = Dr.jacky
email = personal.email@gmail.com
signingKey = ""
[includeIf "gitdir:/Users/drjacky/Projects/CompanyName/"]
path = /Users/drjacky/gitconfigcompanyname/.gitconfig
[core]
excludesfile = /Users/drjacky/.gitignore_global
autocrlf = input
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[commit]
template = /Users/drjacky/.stCommitMsg
gpgSign = false
[gpg]
program = gpg
[tag]
forceSignAnnotated = false
gitconfigcompanyname/.gitconfig :
[user]
name = My Name
email = my.company.email@company.com
.ssh/config :
# --- Sourcetree Generated ---
Host Personal-GitHub
HostName github.com
User Drjacky
PreferredAuthentications publickey
# IdentityFile /Users/drjacky/.ssh/Personal-GitHub
IdentityFile ~/.ssh/id_rsa
UseKeychain yes
AddKeysToAgent yes
# ----------------------------
# Company Work GitHub
Host github.com/Company
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_companyname
UseKeychain yes
AddKeysToAgent yes
我已经通过
ssh-add
添加了第二个 ssh pub .
/Users/drjacky/Projects/CompanyName/HERE
,然后运行这个:
git clone httpUrlOfMyCompanyRepo
或
git clone sshOfMyCompanyRepo
;没关系,它没有访问权限:
remote: Repository not found.fatal: repository 'https://github.com/CompanyName/reponame.git/' not found
git config user.email
, 在 CompanyName 文件夹路径下,它显示了我的个人电子邮件。
git config --list
:
credential.helper=osxkeychain
user.name=Dr.jacky
user.email=personal.email@gmail.com
user.signingkey=
includeif.gitdir:/Users/drjacky/Projectz/CompanyName/.path=/Users/drjacky/gitconfigcompanyname/.gitconfig
core.excludesfile=/Users/drjacky/.gitignore_global
core.autocrlf=input
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
commit.template=/Users/drjacky/.stCommitMsg
commit.gpgsign=false
gpg.program=gpg
tag.forcesignannotated=false
(END)
git bugreport
:
[System Info]
git version:
git version 2.28.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64
compiler info: clang: 11.0.3 (clang-1103.0.32.62)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/zsh
备注 :
最佳答案
我不得不改变 Host github.com/Company
至 Host github.com-Company
在 ssh/config
.
然后,像这样克隆:git clone git@github.com-Company:Company/repoName.git
但是,还是希望有更好的解决方案,而不是更改 ssh 地址/HTTP URL。
资料来源:
.gitconfig
对于个人/其他所有项目:
[user]
name = Dr.jacky
email = email@personal.com
[core]
sshCommand = ssh -i ~/.ssh/id_rsa -F /dev/null
工作
.gitconfig
对于公司项目:
[user]
name = Work Name
email = work@company.com
[core]
sshCommand = ssh -i ~/.ssh/id_rsa_companyname -F /dev/null
并更改了全局
.gitconfig
对此:
[user]
name = Dr.jacky
email = email@personal.com
signingKey = ""
[includeIf "gitdir:/Users/drjacky/*"]
path = /Users/drjacky/gitconfigpersonal/.gitconfig
[includeIf "gitdir:/Users/drjacky/Projectz/CompanyName/"]
path = /Users/drjacky/gitconfigcompanyname/.gitconfig
感谢
leddzip !
关于git: includeIf 不使用 git clone,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63307136/
我正在尝试设置我的 git 配置,以便我可以使用工作环境和个人环境。 这是我的 ~.gitconfig 文件的内容(碰巧 work 和 private 在 github 上): [url "git@
我正在尝试让多个 gitconfigs 用于我的存储库使用 [includeIf] . 我在 ~/Development/Business/work/有一个定期仓库,在 ~/Development/B
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 8年前关闭。 Improve thi
.gitconfig : [user] name = Dr.jacky email = personal.email@gmail.com signingKey = "" [in
我是一名优秀的程序员,十分优秀!