【发布时间】:2022-12-06 02:54:17
【问题描述】:
我试图按照说明对 github 进行提交,但它立即崩溃了
D:\Work\htdocs\temp>git add *
warning: LF will be replaced by CRLF in .htaccess.
The file will have its original line endings in your working directory\
D:\Work\htdocs\temp>git commit -m "first commit"
[master 2f28669] first commit
1 file changed, 6 insertions(+)
create mode 100644 .htaccess
D:\Work\VikasSite\htdocs\temp>git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin master
然后我意识到默认情况下在 Github 中 master 分支被重命名为 main,所以我再次尝试了同样的事情
D:\Work\htdocs\temp>git push origin --delete master
To https://github.com/*******/php_social_network.git
- [deleted] master
D:\Work\htdocs\temp>git commit -m "test"
[master *****] test
2 files changed, 39 insertions(+)
create mode 100644 github
create mode 100644 github.pub
D:\Work\htdocs\temp>git push --set-upstream origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/******/php_social_network.git'
我在这里做错了什么,我该如何推送到 main 分支?
【问题讨论】: