我昨天还能推,现在却推不动了。

当我使用git push origin master时,我得到一个错误:

$ git remote -v
origin  https://github.com/REDACTED.git (fetch)
origin  https://github.com/REDACTED.git (push)

$ git push origin master
Username for 'https://github.com': REDACTED
Password for 'https://REDACTED@github.com':
To https://github.com/REDACTED.git
! [rejected]         master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/REDACTED.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我的工作目录和远程存储库看起来像什么:


当前回答

我按照下面的步骤,它对我很有效。

 rm -rf .git
 git init
 git add .
 git commit -m"first message"
 git remote add origin "LINK"
 git push -u origin master

其他回答

做这些:

git rm --cached *
git add .
git commit -m"upload"
git push --set-upstream origin master

你的宣传和你的故事有关吗。如果是,检查jira的工作流程状况。 管理员可以根据某些工作流程配置为只允许推送。

在Azure DevOps中使用Git存储库时,问题在于分支策略要求所有对分支的更改必须通过pull request (PR)进行。尝试直接将更改推到分支生成错误“failed to push some refs to…”

我创建了一个公关部门,毫无问题地进行推广。

在我们的例子中,重新尝试push解决了问题。可能是网络速度慢导致了这个问题。

不幸的是,我无法用其他解决方案解决这个问题,但我的问题是我想要推送的分支名称不被远程接受。我把它改成了正确的格式,它被接受了。

它是test/testing_routes,我需要将其更改为testing_route,其中正斜杠(/)是远程不允许的。

您应该确保分支名称格式正确。