Github 错误:无法将一些参考推送到 github.com

bro*_*k18 0 github

我已经安装了 git,创建了存储库,然后我尝试使用 cmd 从 vs code 推送到 github 存储库

git push -u origin main
Run Code Online (Sandbox Code Playgroud)

Git 说错误:无法将一些引用推送到 'github.com:loobj126/boredape-dapp-bj.git''

有什么问题?

https://github.com/loobj126/boredape-dapp-bj

在此输入图像描述

我已经采取了一些方法但仍然没有解决

https://komodor.com/learn/how-to-fix-failed-to-push-some-refs-to-git-errors/

在此输入图像描述

最新输入:

初始化后

[2022-04-20T08:44:06.669Z] Validating found git in: C:\Program Files\Git\cmd\git.exe
[2022-04-20T08:44:06.796Z] Using git 2.35.3.windows.1 from C:\Program Files\Git\cmd\git.exe
[2022-04-20T10:45:43.723Z] > git init [128ms]
[2022-04-20T10:45:44.399Z] > git rev-parse --git-dir [72ms]
[2022-04-20T10:45:44.403Z] Open repository: c:\Users\loobj\boredape-dapp-bj
[2022-04-20T10:45:44.606Z] > git fetch [197ms]
[2022-04-20T10:45:44.676Z] > git symbolic-ref --short HEAD [119ms]
[2022-04-20T10:45:44.765Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master [85ms]
[2022-04-20T10:45:44.872Z] > git remote --verbose [99ms]
[2022-04-20T10:45:44.888Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [119ms]
[2022-04-20T10:45:45.019Z] > git config --get commit.template [122ms]
[2022-04-20T10:45:45.040Z] > git config --local branch.master.github-pr-owner-number [121ms]
[2022-04-20T10:45:45.300Z] > git symbolic-ref --short HEAD [101ms]
[2022-04-20T10:45:45.385Z] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track) refs/heads/master refs/remotes/master [80ms]
[2022-04-20T10:45:45.490Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [101ms]
[2022-04-20T10:45:45.507Z] > git remote --verbose [115ms]
[2022-04-20T10:45:45.589Z] > git config --get commit.template [76ms]
Run Code Online (Sandbox Code Playgroud)

点击推送

在此输入图像描述 在此输入图像描述

[2022-04-20T10:59:18.763Z] > git Push Boredape-dapp-bj master [153ms] [2022-04-20T10:59:18.763Z] 错误:src refspec master 不匹配任何错误:推送失败一些参考 'https://github.com/loobj126/boredape-dapp-bj.git' [2022-04-20T11:00:41.028Z] > git fetch [141ms] [2022-04-20T11:00:41.220 Z] > git symbolic-ref --short HEAD [68ms] [2022-04-20T11:00:41.286Z] > git for-each-ref --format=%(refname)%00%(upstream:short)% 00%(objectname)%00%(上游:track) refs/heads/master refs/remotes/master [63ms] [2022-04-20T11:00:41.380Z] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [91ms] [2022-04-20T11:00:41.394Z] > git remote --verbose [102ms] [2022-04-20T11:00:41.485 Z] > git config --get commit.template [84ms]

小智 6

解决方案 1:错误:src refspec master 不匹配任何内容。\n您需要执行的只是使用正确的消息进行 git commit,然后执行 git Push 到远程源以避免任何错误。

\n
mkdir repo && cd repo\ngit remote add origin /path/to/origin.git\ngit add .\n\ngit commit -m "initial commit"\ngit push origin master\n
Run Code Online (Sandbox Code Playgroud)\n

解决方案 2 \xe2\x80\x93 首先,检查您拥有的引用,一旦找到,就将 git 推送到特定的远程分支。

\n
# To get all the ref \ngit show-ref\n\n# replace with your branch name according to ref \ngit push origin HEAD:<branch>\n
Run Code Online (Sandbox Code Playgroud)\n

这对我有用。

\n