如何解决GitHub配置文件冲突?

huangapple go评论56阅读模式
英文:

How to fix GitHub profile conflicts?

问题

终端上的全局配置文件为0xminer11,并且在提交代码时也使用了相同的配置文件,我希望在推送代码时仍然使用相同的配置文件,但在推送时出现了不同的配置文件。

你可以查看我的日志。

naveenarali@NaveenAralis-MacBook-Air gasless-Txs. % git config --global user.name 
0xminer11
naveenarali@NaveenAralis-MacBook-Air gasless-Txs. % git push origin dev
remote: Permission to 0xminer11/gasless-Txs..git denied to cclchd-naveenkumar.
fatal: unable to access 'https://github.com/0xminer11/gasless-Txs..git/': The requested URL returned error: 403

所以是否有解决这些冲突的解决方案或建议?

我已在全局配置了GitHub账户的用户名和电子邮件,但仍然面临相同的问题。

英文:

The global profile on my terminal was 0xminer11 and its committed using the same profile and I want to use the same profile to push the code as well. but while pushing, it was taking on a different profile.

you can see my logs.

naveenarali@NaveenAralis-MacBook-Air gasless-Txs. % git config --global user.name 
0xminer11
naveenarali@NaveenAralis-MacBook-Air gasless-Txs. % git push origin dev
remote: Permission to 0xminer11/gasless-Txs..git denied to cclchd-naveenkumar.
fatal: unable to access 'https://github.com/0xminer11/gasless-Txs..git/': The requested URL returned error: 403

So is there any solution or suggestions to maintain these conflicts?.

I globally configured my GitHub account username and email. but still am facing the same issue.

答案1

得分: 1

Double-check your git credential helper, which might have cached the wrong credentials for github.com accessed with HTTPS.

printf "host=github.com\nprotocol=https" | git credential-xxx get

(Replace xxx with the value of git config --global credential.helper)

If you have multiple accounts accessing GitHub, it is better to include the GitHub user account name (which, as commented, has nothing to do with git config user.name) in the remote URL

cd /path/to/local/repository
git remote set-url origin https://0xminer11@github.com/0xminer11/myRepo
                                  ^^^^^^^^^^

Then a git push should trigger a popup asking for your GitHub 0xminer11 account token (not password)

英文:

Double-check your git credential helper, which might have cached the wrong credentials for github.com accessed with HTTPS.

printf "host=github.com\nprotocol=https" | git credential-xxx get

(Replace xxx with the value of git config --global credential.helper)

If you have multiple accounts accessing GitHub, it is better to include the GitHub user account name (which, as commented, as nothing to do with git config user.name) in the remote URL

cd /path/to/local/repository
git remote set-url origin https://0xminer11@github.com/0xminer11/myRepo
                                  ^^^^^^^^^^

Then a git push should trigger a popup asking for your GitHub 0xminer11 account token (not password)

huangapple
  • 本文由 发表于 2023年4月4日 13:15:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/75925730.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定