apx*_*pxp 27 git visual-studio-code
我的git提交的用户已更改,但我无法更改Visual Studio Code中的内容.
我在git中更改了全局设置,但是当我想在我的新存储库中通过Visual Studio Code推送或同步时,我得到的错误是oldusername没有权限进入newrepository.此时它不是许可.用户名的更改不适用于visual studio代码.当我使用终端时我可以推.它也不是允许olduser推送到新存储库的解决方案.
我在Windows 10上.所以所有其他工具都在工作,但只是在Visual Studio Code我无法更改用户.
欢迎任何重新推荐.
Ram*_*Ram 32
通常 VSCode 使用来自系统凭据管理器的 github 凭据,它不会存储在设置中的任何位置。如题所说Changing the git user inside Visual Studio Code
,不在里面,而在外面。
搜索或转到凭据管理器(Windows 控制面板)-> Windows 凭据-> 从列表中更新 GitHub 密码。
dra*_*ke7 25
这里有两个简单的解决方案:
\ngit图
\n您可以轻松更改扩展中的 git 用户Git Graph
。
.git/配置
\n适用于任何 IDE 的更简单的解决方案是将用户添加到.git/config
当前项目的文件中:
git remote repository test/\n\xe2\x94\x9c\xe2\x94\x80 .git/\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80 config\n\xe2\x94\x9c\xe2\x94\x80 hello_world.md\n
Run Code Online (Sandbox Code Playgroud)\n在.git/config
文件中,更改或添加以下文本:
[user]\n name = bar\n email = bar@mail.com\n
Run Code Online (Sandbox Code Playgroud)\n小智 23
我通过在Git中设置电子邮件地址解决了这个问题:
git config --global user.email "email@example.com"
Run Code Online (Sandbox Code Playgroud)
dio*_*ogo 12
我和 Daniel 遇到了同样的问题,设置提交地址和取消设置凭据助手也对我有用。
git config --global user.email '<git-commit-address>'
git config --global --unset credential.helper
Run Code Online (Sandbox Code Playgroud)
Moh*_*ood 12
您可以使用以下方法查看所有设置及其来源:
git config --list --show-origin
Run Code Online (Sandbox Code Playgroud)
从目录中删除不需要的凭据,然后 VSCode 将在您下次执行 git 操作时要求您提供凭据。
Pul*_*kit 11
在 Visual Studio Code 中按 Ctrl + Shift + G 并转到更多并选择Show git output
. 单击终端并键入git remote -v
并验证源分支中是否具有最新的用户名,例如:
origin git@github.com:DroidPulkit/Facebook-Chat-Bot.git(获取)
origin git@github.com:DroidPulkit/Facebook-Chat-Bot.git(推送)
这里 DroidPulkit 是我的用户名。
如果用户名不是您想要的,则使用以下命令进行更改:
git add remote origin git@github.com:newUserName/RepoName.git
Run Code Online (Sandbox Code Playgroud)
小智 8
这可能是因为保存了凭据并且您需要更新这些凭据,您可以按照以下步骤进行操作
控制面板-> 凭据管理器-> 在通用凭据下,您将能够看到与 git 相关的凭据
如果不起作用,请尝试更新它们删除它们并添加新的
对于其他平台或不同版本的操作系统,您需要找出与 git 相关的凭证的保存位置并更新它们。
检查/获取旧值
git config --global user.email
git config --global user.name
Run Code Online (Sandbox Code Playgroud)
输出:-
youold@email.com
youroldgoodname
设置新值
git config --global user.email yournew@email.com
git config --global user.name yournewgoodname
Run Code Online (Sandbox Code Playgroud)
1. 注销您的当前帐户(仅当您要切换当前帐户时)
2.全局更改git设置
git config --global user.email youshaarif13@gmail.com
git config --global user.name YushaBinArif3
Run Code Online (Sandbox Code Playgroud)
完成上述步骤后,关闭并重新打开vs代码。下次您执行 git 命令时,系统会要求您通过浏览器登录,请确保您在登录所需 GitHub 帐户的浏览器中打开该链接。
归档时间: |
|
查看次数: |
41317 次 |
最近记录: |