【发布时间】:2023-01-30 00:10:08
【问题描述】:
我使用 gitolite 创建了一个空的 git 存储库并将其克隆到我的笔记本电脑上。通常,我可以在笔记本电脑上向其中添加文件并将它们推送到存储库,但现在出现错误:
user@laptop Myproject % git clone newergit:Repo-Myrepo
Cloning into 'Repo-Myrepo'...
warning: You appear to have cloned an empty repository.
user@laptop Myproject % cd Repo-Myrepo
user@laptop Repo-Myrepo % vi test.txt
user@laptop Repo-Myrepo % git add test.txt
user@laptop Repo-Myrepo % git commit -m "add test file to repo"
[main (root-commit) 27aa970] add test file to repo
1 file changed, 1 insertion(+)
create mode 100644 test.txt
user@laptop Repo-Myrepo % git push origin master
error: src refspec master does not match any
error: failed to push some refs to 'newergit:Repo-Myrepo'
这在过去曾经有效,但最近我遇到了这个错误,不知道如何继续?
【问题讨论】:
-
运行
git status和git branch -al并添加它?您可能会发现默认分支现在是main而不是master -
不幸的是, git branch -al 没有解决问题——我得到了和以前一样的错误信息。
标签: gitolite