use*_*902 100 git github git-config
我在终端推送和拉动git然后我在github.com上更改了我的用户名.我去推了一些更改,它无法推送,因为它仍然识别我的旧用户名..如何在终端上的git上更改/更新我的用户名?
Ori*_*iol 104
git config --list以检查当地仓库中的当前用户名和电子邮件.git config [--global] user.name "Full Name"git config [--global] user.email "email@address.com".git/config手动编辑.故障排除?学到更多
Ste*_*n V 82
您可能需要更新远程URL,因为github会将您的用户名放入其中.您可以通过键入来查看原始URL
git config --get remote.origin.url
Run Code Online (Sandbox Code Playgroud)
或者只是转到Github上的存储库页面并获取新的URL.然后用
git remote set-url origin https://{new url with username replaced}
Run Code Online (Sandbox Code Playgroud)
使用新用户名更新网址.
Dal*_*yaG 56
编辑:除了更改您的姓名和电子邮件您可能还需要更改您的凭据:
要仅在一个存储库中进行本地更改,请从存储库中输入终端
git config credential.username "new_username"
改变全球使用
git config credential.username --global "new_username"
(编辑解释:如果你不改变user.email和user.name,你将能够推动你的更改,但它们将在以前的用户下的git中注册)
下次push,您将被要求输入您的密码
Password for 'https://<new_username>@github.com':
sra*_*nji 35
要设置帐户的默认身份globally,请在命令下方运行
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git config --global user.password "your password"
Run Code Online (Sandbox Code Playgroud)
要仅在当前存储库中设置标识,请--global在Project/Repo目录中删除并运行以下命令
git config user.email "you@example.com"
git config user.name "Your Name"
git config user.password "your password"
**Example:**
email -> organization email Id
name -> mostly employee Id or FirstName, LastName
Run Code Online (Sandbox Code Playgroud)
Raj*_*lam 15
请更新新的用户存储库URL
git remote set-url origin https://username@bitbucket.org/repository.git
Run Code Online (Sandbox Code Playgroud)
我尝试使用下面的命令,它不起作用:
git config user.email "email@example.com"
git config user.name "user"
Run Code Online (Sandbox Code Playgroud)
要么
git config --global user.email "email@example.com"
git config --global user.name "user"
Run Code Online (Sandbox Code Playgroud)
小智 12
这个问题有一个简单的解决方案,解决方案是删除你的钥匙串的证书,之前的事情会导致它再次询问用户和密码。
脚步:
搜索证书 gitHub.com。
删除 gitHub.com 证书。
在终端中使用 git 执行任何操作。这再次询问您的用户名和密码。
对于 Windows 用户,请通过以下方式找到钥匙链:
控制面板 >> 用户帐户 >> 凭据管理器 >> Windows 凭据 >> 通用凭据
Emm*_*son 10
在您的终端上执行:
git config credential.username "prefered username"
Run Code Online (Sandbox Code Playgroud)
要么
git config --global user.name "Firstname Lastname"
Run Code Online (Sandbox Code Playgroud)
**Check by executing this**
git config --list
**Change user email**
git config --global user.email "email@example.com"
**Change user name**
git config --global user.name "user"
**Change user credential name**
git config --global credential.username "new_username"
**After this a window popup asking password.
Enter password and proceed.**
Run Code Online (Sandbox Code Playgroud)
对于Github
git config --local user.name "another_username"
git config --local user.email "email@example.com"
git remote set-url origin https://another_username@github.com/repo_url
Run Code Online (Sandbox Code Playgroud)
我建议您通过简单地转到.git文件夹,然后打开配置文件来执行此操作。在文件中粘贴您的用户信息:
[user]
name = Your-Name
email = Your-email
Run Code Online (Sandbox Code Playgroud)
应该是这样。
首先,您需要从本地计算机更改凭据
git config [--global] user.name "Your Name"
git config [--global] user.email "email@address.com"
Run Code Online (Sandbox Code Playgroud)