【发布时间】:2019-11-07 14:50:45
【问题描述】:
我以正确的方式配置了所有设置,但 git 仍然默认使用不正确的用户名。
我在 git config 中有以下设置:
alias.hist=log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:CORRECT_USER/project
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
user.email=ID+CORRECT_USER@users.noreply.github.com
user.name=CORRECT_USER
而且看起来不错。
我的 /.ssh/config 也有:
Host github.com-CORRECT_USER
HostName github.com
User CORRECT_USER
IdentityFile ~/.ssh/CORRECT_USER_KEY
所以看起来也不错。
但是,当我...
git push
我明白了:
ERROR: Permission to denied to TOTALLY_DIFFERENT_WRONG_USERNAME.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
git 尝试使用正确的用户名和正确的 ssh/config 使用 TOTALLY_DIFFERENT_WRONG_USERNAME 推送正确的 repo,发生了什么?应该在哪里设置?如何取消设置?
【问题讨论】:
标签: git github ssh public-key