git多个帐户和存储库问题 [英] git multiple accounts and repository problems
问题描述
我想在Visual Studio项目中使用git.我已经有一个可以正常使用的个人帐户.现在,我的老板给我提供了一个新帐户,Visual Studio仍在尝试使用我的个人帐户,并给我发布和同步错误.
所以我遵循了本教程: https://github.com/ge/geweb.git
当我尝试推送地理信息时,它说未找到存储库 当我尝试推动起源时,它说 错误:src refspec master不匹配.
也,我在哪里都没有提到第二个git帐户的用户名和密码
另外,我的git帐户user中有2封电子邮件.config中的电子邮件不是主要的.那可能是原因吗?
我对端到端的工作方式感到困惑.
失败后,我尝试从源中解除项目绑定,并从我的项目文件夹中删除了.git文件 但团队资源管理器仍显示未同步的提交和更改
的输出 git remote -v是:
- myorigin git @ github-ge:ge:getWeb.git(获取)
- myorigin git @ github-ge:ge:geWeb.git(推送)
因此,事实证明我在设置帐户方面遇到了多个问题.
- 它选择了Shaun和Marina识别出的错误来源
所以,我删除了错误的一个,并添加了正确的(georign)
- 我已将自述文件添加到默认存储库,这给了我错误: 提示:更新被拒绝,因为当前分支的尖端在后面 提示:它的远程副本.集成远程更改(例如 提示:"git pull ..."),然后再次按下. 提示:有关详细信息,请参见"git push --help"中的关于快进的注意事项".
所以我在推前尝试了拉力,结果我不得不--allow-unrelated-histories
git pull georigin master --allow-unrelated-histories
然后
git push georigin master
就是这样! (phe)
I want to use git with Visual Studio project. I already had a personal account which worked fine. Now my employer gave me a new account and visual studio is still trying to push to my personal account and gives me error on publish and syncs.
So i followed this tutorial:https://code.tutsplus.com/tutorials/quick-tip-how-to-work-with-github-and-multiple-accounts--net-22574
- created new ssh key
- created an identity to it
- added that ssh key to my github account
- added identity to ssh config
Now some of the things i am unclear about
i have created 2 origins + the default one which are origin (default) myorigin (not used) georigin (path:git@github-ge:ge/geweb)
when i type $ git config --global -l it gives me my correct(employer's) user.name and user.email
geweb is the name of my new repository the url of my repository is:https://github.com/ge/geweb.git
when i try pushing to georigin it says repository not found when i try pushing to origin it says error: src refspec master does not match any.
also, no where have i mentioned my second git account's username and password
also, i have 2 emails in my git account user.email in config is not the primary one. could that be the reason?
i am quiet confused at how it works end-to-end.
After failing to push i tried to unbind the project from source and deleted .git files from my project folder but team explorer is still showing unsynced commits and changes
the output of git remote -v is:
- myorigin git@github-ge:ge:getWeb.git (fetch)
- myorigin git@github-ge:ge:geWeb.git (push)
So, it turned out that i had multiple problems with setting up my account.
- it was picking the wrong origin which was identified by Shaun and Marina
So, i removed the wrong one and added the correct one (georign)
- I had added a readme file to the default repository it was giving me error: hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
so i tried a pull before pushing and it turned out i had to --allow-unrelated-histories
git pull georigin master --allow-unrelated-histories
and then
git push georigin master
Thats it!!! (phew)
这篇关于git多个帐户和存储库问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!