我有本地工作副本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
我不确定会有什么问题。
当前回答
因为您可能没有首先将远程git存储库标识到您的终端。
git remote set-url origin https://github.com/MyRepo/project.git
然后,
git add .
git commit -m "initial commit"
git push origin master
其他回答
在Mac
如果您正在尝试克隆repo....然后这个问题可能会发生,因为你没有回购目前在github帐户目前在钥匙串访问。为了解决这个问题,请尝试使用帐户名进行克隆
Git 克隆 https://username@github.com/org/repo.git
取代
用户名与你的GitHub用户名 与您的组织名称 使用存储库名称进行回购
我也有同样的问题
通过检查http。在git配置中的代理值(我的是不正确的和不需要的), 因此我删除了http。从git配置的代理值
命令:
列出文件中的配置项
git config --list
删除代理
git config --global --unset http.proxy
问题解决了!
增加“个人访问令牌”
自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”。
我通过删除.git文件(隐藏文件夹),然后再次上传解决了这个问题。
我也有这个问题。 为了解决这个问题,I: 1. 移动我的本地。dotfiles到_.dotfiles_bak 2. 克隆我的远程git存储库 3.从_.dotfiles_bak拷贝了我所有的文件 到。dotfiles -除了。git文件夹 3.然后我又可以在当地工作了: 编辑,承诺和推动