Python 错误:无法将某些引用推送到';https://github.com/loliadus/djangolocallibrary.git'

Python 错误:无法将某些引用推送到';https://github.com/loliadus/djangolocallibrary.git',python,django,git,Python,Django,Git,因此,我正在尝试更新git存储库中添加的新文件夹和文件。克隆存储库并将这些文件夹和文件复制到存储库后,我运行以下命令 C:\Users\Ben\Documents\djangoprojects\djangolocallibrary>git add -A C:\Users\Ben\Documents\djangoprojects\djangolocallibrary>git status On branch main Your branch is up to date with 'o

因此,我正在尝试更新git存储库中添加的新文件夹和文件。克隆存储库并将这些文件夹和文件复制到存储库后,我运行以下命令

C:\Users\Ben\Documents\djangoprojects\djangolocallibrary>git add -A

C:\Users\Ben\Documents\djangoprojects\djangolocallibrary>git status
On branch main
Your branch is up to date with 'origin/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   .gitignore
        new file:   catalog/__init__.py
        new file:   catalog/admin.py
        new file:   catalog/apps.py
        new file:   catalog/forms.py
        new file:   catalog/migrations/0001_initial.py
        new file:   catalog/migrations/0002_bookinstance_borrower.py
        new file:   catalog/migrations/0003_auto_20201007_2109.py
        new file:   catalog/migrations/__init__.py
        new file:   catalog/models.py
        new file:   catalog/static/css/styles.css
        new file:   catalog/templates/base_generic.html
        new file:   catalog/templates/catalog/author_confirm_delete.html
        new file:   catalog/templates/catalog/author_detail.html
        new file:   catalog/templates/catalog/author_form.html
        new file:   catalog/templates/catalog/author_list.html
        new file:   catalog/templates/catalog/book_confirm_delete.html
        new file:   catalog/templates/catalog/book_detail.html
        new file:   catalog/templates/catalog/book_form.html
        new file:   catalog/templates/catalog/book_list.html
        new file:   catalog/templates/catalog/book_renew_librarian.html
        new file:   catalog/templates/catalog/bookinstance_list_borrowed_all.html
        new file:   catalog/templates/catalog/bookinstance_list_borrowed_user.html
        new file:   catalog/templates/index.html
        new file:   catalog/tests/__init__.py
        new file:   catalog/tests/test_forms.py
        new file:   catalog/tests/test_models.py
        new file:   catalog/tests/test_views.py
        new file:   catalog/urls.py
        new file:   catalog/views.py
        new file:   locallibrary/__init__.py
        new file:   locallibrary/asgi.py
        new file:   locallibrary/settings.py
        new file:   locallibrary/urls.py
        new file:   locallibrary/wsgi.py
        new file:   manage.py
        new file:   templates/logged_out.html
        new file:   templates/registration/login.html
        new file:   templates/registration/password_reset_complete.html
        new file:   templates/registration/password_reset_confirm.html
        new file:   templates/registration/password_reset_done.html
        new file:   templates/registration/password_reset_email.html
        new file:   templates/registration/password_reset_form.html


C:\Users\Ben\Documents\djangoprojects\djangolocallibrary>git commit -m "Version 1.0 moved into Github"
[main a706353] Version 1.0 moved into Github
 43 files changed, 1577 insertions(+)
 create mode 100644 catalog/__init__.py
 create mode 100644 catalog/admin.py
 create mode 100644 catalog/apps.py
 create mode 100644 catalog/forms.py
 create mode 100644 catalog/migrations/0001_initial.py
 create mode 100644 catalog/migrations/0002_bookinstance_borrower.py
 create mode 100644 catalog/migrations/0003_auto_20201007_2109.py
 create mode 100644 catalog/migrations/__init__.py
 create mode 100644 catalog/models.py
 create mode 100644 catalog/static/css/styles.css
 create mode 100644 catalog/templates/base_generic.html
 create mode 100644 catalog/templates/catalog/author_confirm_delete.html
 create mode 100644 catalog/templates/catalog/author_detail.html
 create mode 100644 catalog/templates/catalog/author_form.html
 create mode 100644 catalog/templates/catalog/author_list.html
 create mode 100644 catalog/templates/catalog/book_confirm_delete.html
 create mode 100644 catalog/templates/catalog/book_detail.html
 create mode 100644 catalog/templates/catalog/book_form.html
 create mode 100644 catalog/templates/catalog/book_list.html
 create mode 100644 catalog/templates/catalog/book_renew_librarian.html
 create mode 100644 catalog/templates/catalog/bookinstance_list_borrowed_all.html
 create mode 100644 catalog/templates/catalog/bookinstance_list_borrowed_user.html
 create mode 100644 catalog/templates/index.html
 create mode 100644 catalog/tests/__init__.py
 create mode 100644 catalog/tests/test_forms.py
 create mode 100644 catalog/tests/test_models.py
 create mode 100644 catalog/tests/test_views.py
 create mode 100644 catalog/urls.py
 create mode 100644 catalog/views.py
 create mode 100644 locallibrary/__init__.py
 create mode 100644 locallibrary/asgi.py
 create mode 100644 locallibrary/settings.py
 create mode 100644 locallibrary/urls.py
 create mode 100644 locallibrary/wsgi.py
 create mode 100644 manage.py
 create mode 100644 templates/logged_out.html
 create mode 100644 templates/registration/login.html
 create mode 100644 templates/registration/password_reset_complete.html
 create mode 100644 templates/registration/password_reset_confirm.html
 create mode 100644 templates/registration/password_reset_done.html
 create mode 100644 templates/registration/password_reset_email.html
 create mode 100644 templates/registration/password_reset_form.html

C:\Users\Ben\Documents\djangoprojects\djangolocallibrary>git push origin master

我有一段时间有这个错误,我不知道如何修复它。谁能帮帮我吗?谢谢大家!

您的状态输出显示,无论出于何种原因,此回购调用其默认分支
main
,而不是
master
。因此,除非您创建一个分支,否则您没有
主分支
;您在
main
分支上,这就是您需要推动的。

因此,我认为自2020年10月1日起,Github开始将其默认分支命名为“main”,而不是以前的“master”

要继续使用使用主分支的约定,可以创建一个主分支,并使用以下命令将更改推送到主分支

git push origin HEAD:master
git push origin main
如果您是存储库所有者,还可以前往github将master设置为默认分支。只需登录您的GitHub帐户,前往您的repo,然后在导航菜单的最右侧选择设置。然后前往分支并选择默认分支

但是,如果希望采用新约定,请使用以下命令

git push origin HEAD:master
git push origin main

只需尝试
git push
git push origin main
,您的分支称为
main
而不是
master