创建新的GitHub帐户后无法从私有存储库克隆/获取 [英] Unable to clone/fetch from private repo after creating new GitHub account

查看:653
本文介绍了创建新的GitHub帐户后无法从私有存储库克隆/获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用git和SourceTree的自由开发人员.

过去的几个月我一直在为拥有私有GitHub存储库的特定客户工作,在那段时间里我一直在使用SourceTree将更改推送到GitHub.

我有另一个客户希望我创建编程入门"课程,而我(愚蠢地)只是使用普通的OS环境/用户,而不是创建新的OS用户.我创建了一个新的"demo" GitHub用户并将其连接到SourceTree,以便向学生展示如何从GitHub存储库中进行推送和拉取.我还关闭了其他客户回购的SourceTree选项卡.

我现在正试图重新开始我的第一个客户的项目,发现自己无法从远程回购中提取/提取,甚至无法重新克隆回购.

当我尝试进行访存或克隆时看到的错误是:

git -c diff.mnemonicprefix = false -c core.quotepath = false --no-optional-locks fetch --prune origin 远程:找不到存储库. 致命:未找到存储库" https://github.com/org_name/repo_name/"

已完成错误,请参见上文.

我尝试过的事情

我已经:

  • 退出浏览器中的演示GitHub帐户,
  • 从SourceTree中删除了模拟帐户,
  • 重新启动计算机
  • 在我的Windows凭据管理器中删除了所有与git/GitHub相关的条目,并在尝试获取时提示您登录
  • 卸载并重新安装SourceTree
  • 我已验证我可以使用HTTPS URL和SSH URL克隆另一个在我的GitHub帐户下的私有存储库.

我想发生的事情

起初,我怀疑git在尝试访问私有存储库时仍以某种方式仍在使用该模拟帐户.但是,我能够从我的GitHub帐户中将另一个GitHub存储库添加到SourceTree并从中获取它,而不会出现问题,如果git或SourceTree仍在使用我的演示帐户的凭据,大概不会发生.

在这一点上,我怀疑尝试连接到存储库的方式可能存在一些问题,但是我不确定它可能是什么.

解决方案

检查您的git config credential.helper.

如果设置,则可能为GitHub缓存了错误的用户凭据:您需要删除它.

在Windows上:

git credential-manager reject https://github.com

在Mac上:

git credential-osxkeychain erase https://github.com

I'm a freelance developer who uses git and SourceTree.

I have been working for the past few months for a particular client who has a private GitHub repo, and I've been using SourceTree during that time to pull and push changes to GitHub.

I have another client who wanted me to create an 'Intro to Programming' course, and I (stupidly) just used my normal OS environment/user rather than creating a new OS user. I created a new 'demo' GitHub user and connected it to SourceTree so that I could show students how to push and pull from a GitHub repository. I also closed the SourceTree tab for my other client's repo.

I'm now trying to get back to working on my first client's project and I'm finding myself unable to fetch/pull from the remote repo, or even to re-clone the repo.

The error I see when I try to do a fetch or clone is:

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch --prune origin remote: Repository not found. fatal: repository 'https://github.com/org_name/repo_name/' not found

Completed with errors, see above.

Things I've tried

I've:

  • logged out of the demo GitHub account in my browser,
  • removed the demo account from SourceTree,
  • restarted my computer
  • deleted any git/GitHub-related entries in my Windows Credential Manager, and was prompted to log in when trying to fetch
  • uninstalled and reinstalled SourceTree
  • I verified that I can clone another private repo that's under my GitHub account using both an HTTPS URL and also an SSH URL.

What I think is happening

At first I suspected that git was somehow still using that demo account when trying to access the private repo. However, I was able to add another GitHub repo from my GitHub account to SourceTree and fetch from it without problems, which presumably wouldn't have happened if git or SourceTree were still using my demo account's credentials.

At this point, I suspect there may be some problem in the way I'm trying to connect to the repository, but I'm not sure what it might be.

解决方案

Check your git config credential.helper.

If set, it might have cached the wrong user credentials for GitHub: you need to remove it.

On Windows:

git credential-manager reject https://github.com

On Mac:

git credential-osxkeychain erase https://github.com

这篇关于创建新的GitHub帐户后无法从私有存储库克隆/获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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