【发布时间】:2022-01-25 20:00:45
【问题描述】:
我在 4 个月前将我的项目与 Github 相关联,今天我无意中删除了我的项目,因此我从 Github 重新安装了最后一次提交并在 Android Studio 中打开它,但是当我进行任何更改时,我无法将它作为主分支推送到 Github,但是如果我将它作为不同的分支推送它可以工作,我如何将更改作为主分支推送(默认)?
在控制台中显示详细信息
12:48:16.974: [Project] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:master --set-upstream
error: failed to push some refs to 'https://github.com/.../...'
hint: Updates were rejected because the remote contains work that you do
To https://github.com/.../...
! refs/heads/master:refs/heads/master [rejected] (fetch first)
hint: not have locally. This is usually caused by another repository pushing
Done
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
【问题讨论】:
-
找出为什么推送被拒绝(查看图片中的“在控制台中显示详细信息”标签)。
-
@DrHowdyDoo 我知道问题出在哪里,但我不知道如何解决,问题是 Github 认为我不是项目的所有者,所以它允许我创建我的仅分支,但我如何告诉 Github 我是项目所有者,即使我可以更新主分支?我以前看过这个链接,但对我不起作用。
-
@SwissCodeMen 我以前看到过这个链接,但对我不起作用。
-
@torek 检查更新
标签: android git android-studio github intellij-idea