我有本地工作副本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
我不确定会有什么问题。
当前回答
您必须生成一个新的令牌:这里的步骤是https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token
在本地删除原点的控制
git remote remove origin
再次添加它,但现在使用您生成的令牌
git remote add origin https: // <token> @ <git_url> .git
然后按一下
git pull https://@<git_url>.git
注意:
什么是git_url?是当前项目示例的url: github.com/yourUser/yourProy
并删除<>字符
其他回答
我也有同样的问题
通过检查http。在git配置中的代理值(我的是不正确的和不需要的), 因此我删除了http。从git配置的代理值
命令:
列出文件中的配置项
git config --list
删除代理
git config --global --unset http.proxy
问题解决了!
如果你正在使用Git桌面应用程序,那么你应该尝试从Git桌面应用程序中推和拉,而不是终端。它会帮助你的。
在我的情况下,我不能克隆github由于用户是错误的。
转到~/.gitconfig 然后尝试删除这行代码(只需删除它,然后保存文件)。
[user]
name = youruser
email = youruser@domain.com
或者尝试在CMD或终端中使用一行代码:git config——global——remove-section user
并尝试再次做git克隆。希望它能帮你度过美好的一天。><
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上:
进入。git文件夹 使用记事本或任何其他编辑器打开“配置”文件 将您的URL从https://github.com/username/repo_name.git更改 https://username: password@github.com/username/repo_name.git
保存并推送代码,它将工作。