如何在终端中更改我的Git用户名? [英] How to change my Git username in terminal?

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

问题描述

我在Terminal中从git推入和拉出,然后在github.com上更改了用户名.我去推送了一些更改,但由于它仍然可以识别我的旧用户名而无法推送..如何在终端中的git上更改/更新我的用户名?

I was pushing and pulling from git in Terminal then I changed my username on github.com. I went to push some changes and it couldn't push because it was still recognizing my old username.. How do I change/update my username on git in terminal?

推荐答案

您可能需要更新远程URL,因为github将您的用户名放在其中.您可以输入

You probably need to update the remote URL since github puts your username in it. You can take a look at the original URL by typing

git config --get remote.origin.url

或者只是转到Github上的存储库页面并获取新的URL.然后使用

Or just go to the repository page on Github and get the new URL. Then use

git remote set-url origin https://{new url with username replaced}

使用您的新用户名更新URL.

to update the URL with your new username.

这篇关于如何在终端中更改我的Git用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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