[英]Github multiple repositories defaulting to old username
我以看起來正確的方式配置了所有設置,但是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嘗試使用TOTALLY_DIFFERENT_WRONG_USERNAME使用正確的用戶名和正確的ssh / config推送正確的repo是怎么回事? 將在哪里設置,如何取消設置?
正在運行:
$ ssh -Tv git@github.com
將顯示您的./ssh/config與該存儲庫實際連接的身份。
在這種情況下,它看起來像是在運行:
debug1: /etc/ssh/ssh_config line 19: Applying options for *
並且使用了您的默認用戶名,即TOTALLY_DIFFERENT_WRONG_USERNAME。
您可以像這樣創建不同的配置:
# user1
Host github.com
HostName github.com
User user1
# user2
Host github.com
HostName github.com
User user2
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.