git从终端推送错误的用户 [英] git pushes with wrong user from terminal

查看:103
本文介绍了git从终端推送错误的用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个git和我的终端问题。



下面是一个画廊向您展示我的问题: http://imgur.com/a/6RrEY



当我从我的终端推送提交时,git说我把它们推到另一个用户名,这是来自我的组织(我的公司)的用户,根本没有任何提交,似乎它不属于任何人:(检查图库的第一张图片)



但是,当我使用Github for mac时,并没有发生这种情况,在feed中,我看到了我自己推送的提交。



这个问题也影响我的个人存储库,我的终端说我没有权限在这些存储库上推送提交(这显然是错误的),因为它试图用这个用户推送它:(check gallery second pic)



猜猜是什么?这也不会发生在Github上。



几天前,我将电脑换成了全新的电脑,所以我重置了我所有的github ssh密钥并且只留下了Github为Mac生成的新内容,所以我不认为在某处存在一些隐藏的用户/ ssh密钥,这个硬盘是全新的:(查看第三张图片)



我的.gitconfig文件全部清楚,只有我的凭据:(检查图库第四张图片)



(我对我可怜的Gimp技能和星球大战参考文件表示歉意,我很抱歉我没有得到它,帮助,StackOverflow,你是我唯一的希望。 )



编辑 ssh-add -l <​​/ code>只显示创建好的ssh密钥由github为mac和我只有一个github帐户



EDIT2: ssh -T git@github.com 认出我为好用户。



EDIT3:经过几次测试后, minal使用我的用户名进行提交,但是用另一个提交,Github用于mac提交,并推荐使用正确的用户名。这种情况发生在每个我已经/制作的回购(甚至是新回购)中。



EDIT4:在个人存储库 git log --pretty =%h%an%ae好的用户名



EDIT5:在我的 env 。即使我尝试设置这些变量,但仍然存在良好的凭证问题。



EDIT6:如果强制用户进入 /。git / config 存储库的路径,但我不认为这是个好的选择: http://USER@github.com/ USER / REPO.git



EDIT7:我们删除了推送提交给我的git用户,另一个错误: remote:无效的用户名或密码。致命:https://github.com/USER/REPO.git/认证失败



最终编辑:I使用自制软件安装git,输入 git config --global push.default简单 ,现在即使不强制用户也需要我的凭据。真奇怪。感谢大家的帮助,你们真是太棒了!

,解决这个问题的唯一方法是完全重新安装git并键入 git config --global push.default simple 来重写好的证书。


I have an issue with git and my terminal.

Here's a gallery to show you my issue : http://imgur.com/a/6RrEY

When I push commits from my terminal, git says I push them with another username, that's a user from my organisation (my company) with no commit at all and it seems it belongs to no one : (check gallery first pic)

But this doesn't happen when I use Github for mac, in the feed I see the commits pushed by myself.

The problem also affects my personal repositories, my terminal says that I don't have the permission to push commits on those repositories (which is obviously wrong) since it tries to push it with this user : (check gallery second pic)

Guess what ? This doesn't happen with Github for mac too.

I changed my computer to a brand new one few days ago, so I reset'ed all my ssh key of github and left only a new one generated by Github for Mac so I don't think that there's some ghost user/ssh key hidden somewhere, this hdd is brand new : (check gallery third pic)

My .gitconfig file is all clear, there's only my credentials : (check gallery fourth pic)

I really don't get it, help, StackOverflow, you're my only hope.

(My apologies for my poor Gimp skills and the Star Wars reference)

EDIT : ssh-add -l only shows the good ssh key created by github for mac and I have only one github account

EDIT2 : ssh -T git@github.com recognize me as the good user.

EDIT3 : After a few tests it looks like my terminal does the commits with my username, but pushes them with the other one, Github for mac commits and pushes with the good username.This situation happen with every repo I have/make (even new ones).

EDIT4 : In a personal repository git log --pretty="%h %an %ae" shows my good username

EDIT5 : No sign of environment variables that would override my credentials in my env. Even if I try to set those variables with the good credentials problem persists.

EDIT6 : Things work back normally if I force the user in the path of /.git/config of a repository but I don't think that's the good option : http://USER@github.com/USER/REPO.git

EDIT7 : We deleted the git user that pushed the commits for me and this brings another error : remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/USER/REPO.git/'

FINAL EDIT : I installed git with homebrew, typed git config --global push.default simple and now it takes my credentials even without forceing the user. That's strange. Thanks everybody for your help, you're great guys !

解决方案

Despite all the great options given by other users, the only way to fix this was to reinstall git completely and type git config --global push.default simple to rewrite good credentials.

这篇关于git从终端推送错误的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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