【发布时间】:2023-03-30 17:14:01
【问题描述】:
这是我的仓库 https://github.com/kiotie32/artbit-text.git 当我这样做时
$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/kiotie32/arbit-text.git/' not found
我在 Windows 10 机器上。我已经配置了用于这台笔记本电脑的 ssh 密钥。 我做了一个ls,我可以看到
MINGW64 ~/.ssh
$ ls
kiotie32_rsa kiotie32_rsa.pub known_hosts
我阅读了this thread 上给出的所有答案 我更改了存储在 Windows 凭据管理器中的密码。
我检查git remote -v | head -n1 | awk '{print $2}' | sed 's/.*\///' | sed 's/\.git//'
我得到以下输出arbit-text
我更改了存储在 Windows 凭据管理器中的密码,可能存储了旧密码。
我没有收到任何询问用户名密码的弹出窗口。 (配置了一个 ssh 密钥,但不确定它是否适用于这个 Windows 10 环境,我将密钥存储在 git bash 中的 .ssh 中) 现在我做
$ git remote add origin https://github.com/kiotie32/arbit-text.git
fatal: remote origin already exists.
那我做
$ git push -u origin master
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/kotie32/arbit-text.git'
所以我无法理解为什么会出现这个错误/
我在这里尝试了解决方案https://stackoverflow.com/a/7572252/13012032第一个回答做git commit -m "initial master"
然后我得到了$ git push origin master remote: Repository not found. fatal: repository 'github.com/kotie32/arbit-text.git' not found
然后我尝试了 cmetsgit add -all 然后我做了$ git push origin master remote: Repository not found. fatal: repository 'https://github.com/kotie32/arbit-text.git/' not found
然后从另一个答案https://stackoverflow.com/a/4183856/13012032我试过了$ git show-ref
79d1730e9aa78f68a11ec4de6a0e8d6b66f17afb refs/heads/master
然后我做了$ git push origin HEAD:master
remote: Repository not found.
fatal: repository 'https://github.com/kotie32/arbit-text.git/' not found
我注意到上面 url 拼写 kotie32 的最后一个错误是错误的,应该是
kiotie32
检查 .git 文件夹中的配置文件
在那里我看到了以下内容
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://github.com/kiotie32/arbit-text.git
fetch = +refs/heads/*:refs/remotes/origin/*
所以这里的网址是正确的拼写是kiotie32 这是正确的。
好的,我现在注意到已经形成了 2 个目录。
project folder/.git/.git
<project folder>/.git 的配置文件有错误的 url
并且内部的,即<project folder>/.git/.git 具有正确的网址。
我更改了<project folder>/.git 的配置文件并删除了子目录.git/.git
新的配置文件有
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://github.com/kiotie32/arbit-text.git
fetch = +refs/heads/*:refs/remotes/origin/*
然后我又做了
$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/kiotie32/arbit-text.git/' not found
然后我做了
$ git remote set-url origin https://github.com/kiotie32/artbit-text.git
那么现在我可以推送到 master 分支了。
【问题讨论】:
-
我尝试了在你的第一个链接的第一个答案中给出的解决方案来做
git commit -m "initial master" and then I got$ git push origin master remote: Repository not found。致命:未找到存储库'github.com/kotie32/arbit-text.git'然后我尝试在 cmetsgit add -all中尝试,然后我做了$ git push origin master remote: Repository not found. fatal: repository 'https://github.com/kotie32/arbit-text.git/' not found -
这能回答你的问题吗? git error: failed to push some refs to