koe*_*era 17 git push git-push
这是我的存储库 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
Run Code Online (Sandbox Code Playgroud)
我在 Windows 10 机器上。我已经配置了与这台笔记本电脑一起使用的 ssh 密钥。我做了一个 ls 我可以看到
MINGW64 ~/.ssh
$ ls
kiotie32_rsa kiotie32_rsa.pub known_hosts
Run Code Online (Sandbox Code Playgroud)
我阅读了此线程上给出的所有答案, 我更改了存储在 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.
Run Code Online (Sandbox Code Playgroud)
然后我做
$ 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'
Run Code Online (Sandbox Code Playgroud)
所以我无法理解为什么会出现这个错误/
我在这里尝试了解决方案/sf/answers/530057671/第一个答案要做
git commit -m "initial master"
然后我得到了
$ git push origin master remote: Repository not found. fatal: repository 'github.com/kotie32/arbit-text.git' not found
然后我在评论中尝试
git add -all 然后我做了
$ git push origin master remote: Repository not found. fatal: repository 'https://github.com/kotie32/arbit-text.git/' not found
然后从另一个答案/sf/answers/292869951/我试过了
$ 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/*
Run Code Online (Sandbox Code Playgroud)
所以这里 urlkiotie32是正确的拼写是正确的。
好的,我现在注意到已经形成了 2 个目录。
project folder/.git/.git
和配置文件的<project folder>/.giturl 错误,内部 ie 的<project folder>/.git/.giturl 正确。
我更改了配置文件<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/*
Run Code Online (Sandbox Code Playgroud)
然后我再做一次
$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/kiotie32/arbit-text.git/' not found
Run Code Online (Sandbox Code Playgroud)
然后我做了
$ git remote set-url origin https://github.com/kiotie32/artbit-text.git
Run Code Online (Sandbox Code Playgroud)
那么现在我可以推送到主分支了。
Aru*_*r N 21
只需尝试以下命令:-
git push origin master --force
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你!谢谢!
小智 21
I had the same problem but this command resolved it.
Replace:
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
with following command:
git push -u origin main
Run Code Online (Sandbox Code Playgroud)
or
git push -f origin main
Run Code Online (Sandbox Code Playgroud)
小智 8
检查是否您正在尝试推送而不提交。尝试提交您的更改。
git commit -m "my commit"
Run Code Online (Sandbox Code Playgroud)
或键入git branch以查看您是否已设置远程 url。如果没有任何显示,则添加远程源 url git remote add origin https://github.com/username/projectname.git。然后尝试git push origin master
这对我有帮助。
git push origin master:main
Run Code Online (Sandbox Code Playgroud)
这master是我的本地分支,main是我的远程分支。我认为这是因为 Github 将 master 重命名为 main
git commit -m "first commit"
git add .
git status
git push origin main(或者无论你的主分支或主分支的名称是什么)。
| 归档时间: |
|
| 查看次数: |
77067 次 |
| 最近记录: |