我的旧用户名仍在使用中 [英] my old username is still in use

查看:100
本文介绍了我的旧用户名仍在使用中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经改变了我的用户和电子邮件的git与这些命令

  git config --global user.namemaa 
git config user.emailmaa@gmail.com

我确认了更改

  git config --global user.name 
git config user.email

并显示正确的名称。
然而,当我推旧用户名时使用:

  git push -u原点大师
远程:maa / brain.git拒绝给old_user_name的权限。
致命:无法访问'https://github.com/maa/brain.git/':请求的URL返回错误:403


解决方案

user.name user.email 设置仅用于提交元数据。



正如我看到您使用的是https传输,因此用户名以某种方式存储。在我看来,有两种选择:


  1. 您正在使用%HOME%/。netrc %HOME%/ _ netrc %HOMEDRIVE %% HOMEPATH%\_netrc

  2. 您的用户名包含在push-url(如 https://username@github.com / ... )中,您需要更新 .git / config ,例如通过发行 git remote set-url https://< newusername> @ github.com /< newusername> / yourRepo

  3. 您正在使用git凭证助手。这取决于您使用哪一个(也可能使用哪个操作系统,适用于Windows Mac OS X )。

作为一般规则,您可以在CLI上尝试以下操作(基于 $ credentialhelper )(你可以使用-shell-keychain /rel =nofollow noreferrer> 2 git config credential.helper ,对于Mac OS X,它很可能是 osxkeychain ,它可能是 wincred manager ):

  $ git credential- $ credentialhelper erase 
host = github.com
protocol = https
[按回车键]


I have changed my user and email for git with those commands

git config --global user.name "maa"
git config user.email "maa@gmail.com"

I confirmed the change with

git config --global user.name
git config user.email

and it shows the right names. However when I push the old user name is used:

git push -u origin master
remote: Permission to maa/brain.git denied to old_user_name.
fatal: unable to access 'https://github.com/maa/brain.git/': The requested URL returned error: 403

解决方案

The user.name and user.email settings are only used for commit meta data.

As I can see you are using https transport, so the username is stored somehow. To my mind there are two options:

  1. You are using %HOME%/.netrc (%HOME%/_netrc or %HOMEDRIVE%%HOMEPATH%\_netrc on Windows)
  2. Your username is included in the push-url (like https://username@github.com/...), here you need to update .git/config, e.g. by issuing git remote set-url https://<newusername>@github.com/<newusername>/yourRepo
  3. You are using a git credential helper. Here it depends which one you use (and maybe which OS you use, see for Windows, Mac OS X).

As a general rule you can try the following on the CLI (based on 2), where you replace $credentialhelper with your credential-helper (you can find it using git config credential.helper, for Mac OS X it is likely osxkeychain on Windows it might be wincred or manager):

$ git credential-$credentialhelper erase
host=github.com
protocol=https
[Press Return]

这篇关于我的旧用户名仍在使用中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆