我有本地工作副本SourceTree。和所有的操作工作得很好,我可以简单的获取,推,拉等通过SourceTree。我只需要在SourceTree中不存在的force push。
我打开终端使git按-f
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found
我不确定会有什么问题。
我有本地工作副本SourceTree。和所有的操作工作得很好,我可以简单的获取,推,拉等通过SourceTree。我只需要在SourceTree中不存在的force push。
我打开终端使git按-f
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found
我不确定会有什么问题。
当前回答
I was trying to clone a repo and was facing this issue, I tried removing all git related credentials from windows credentials manager after that while trying to clone git was asking me for my credentials and failing with error invalid username or password. This was happening because the repo I was trying to clone was under an organization on github and that organization had two factor auth enabled and git bash probably do not know how to handle 2fa. So I generated a token from https://github.com/settings/tokens and used the github token instead of password while trying to clone the repo and that worked.
其他回答
如果你在windows上得到控制面板-> windows凭据,然后从通用凭据选项删除github凭据。然后尝试克隆
在我们的案例中,这只是一个在github中授予写权的案例。最初用户只有读权限,它给出了这个错误。
增加“个人访问令牌”
自2021年以来,Github支持PAT而不是名称/密码(阅读这里如何创建和使用一个),所以我们只是把它添加到远程起源。
在Windows上
访问。git文件夹,打开配置文件进行编辑。如。vim配置。 将URL更改为 https://github.com/ <用户名> / < repo_name > . 来 https:// [personal-access-token] @github.com/ <用户名> / < repo_name > . 其中[personal-access-token]是你在github创建的PAT散列。 保存配置文件,现在推送应该可以工作了。
快捷方式:
git remote remove origin
git remote add origin https://[personal-access-token]@github.com/username/repo_name.git
更新
生成令牌时,如果希望令牌长时间工作,请选择“No expiration”。
这里的问题是windows凭据管理器,请去控制面板,搜索凭据管理器,并删除它关于github的所有内容
在Mac
如果您正在尝试克隆repo....然后这个问题可能会发生,因为你没有回购目前在github帐户目前在钥匙串访问。为了解决这个问题,请尝试使用帐户名进行克隆
Git 克隆 https://username@github.com/org/repo.git
取代
用户名与你的GitHub用户名 与您的组织名称 使用存储库名称进行回购