Git 流程发布完成 - 权限被拒绝

Git Flow Release Finish - Permission denied

我使用 git flow 已经有一段时间了,现在是时候完成第一个版本 v1.0.0 了。为此,我在 Windows 上使用 SourceTree。

当我想完成发布时,我收到了这个错误:

sh.exe C:\Users\xy\AppData\Local\Atlassian\SourceTree\gitflow_local\gitflow\git-flow release finish -f C:\Users\xy\AppData\Local\Tempffrpxef.20z v1.0.0
Switched to branch 'master'

error: unable to create file component/admin/config.xml (Permission denied)

There were merge conflicts.

Completed with errors, see above.

我不知道为什么会出现这个错误,因为不应该有任何文件权限问题,因为以前在功能分支中工作时从未发生过。

在上述失败之后,我基本上在我的工作副本中完成了从 develop 到 master 的所有更改。我简单地取消了所有这些更改并删除了新文件等等。不,不存在冲突。所以我又准备好完成我的发布了。

目前开发和发布在同一个阶段,当然还有很多提交在master之前:

如何在没有 运行 解决这个问题的情况下完成我的发布?

有什么方法可以将当前 develop/release 阶段强加给 master 吗?基本上所有的开发提交都应该应用到主分支上——所以当它们出现时所有的合并冲突我想用开发分支版本来解决。这可能吗?

如图issue 107, that error message means the merge cannot complete because of conflict 'see git-flow-release#L225-L240):

  if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
    git checkout "$MASTER_BRANCH" || \
      die "Could not check out $MASTER_BRANCH."
    git merge --no-ff "$BRANCH" || \
      die "There were merge conflicts."

这意味着您需要 resolve the merge conflicts, and complete the merge first

OP hbit 添加

Basically all the development commits should be applied onto the master branch - so all merge conflicts when they appear I'd like to solve with the development branch version.

这是典型的 develop 分支重新基于 master:

  • rebase 意味着您在 master 之上重播 develop 分支,解决 develop 分支
  • 中的任何冲突
  • rebase 意味着,一旦 develop 分支位于 master(rebased)之上,合并到 master(由 git-flow release finish 完成)将是琐碎的快进一个。

我想这个错误不仅会在您修改了权限时发生,而且如果您修改了该文件的所有权(这会导致权限更改)也会发生。

我自己无法摆脱这个问题,所以我所做的(和为我工作的)就像“把骨架藏在壁橱里”。目的是将错误文件隔离到一个测试分支中,之后您可以删除它。

sudo rm badfile.xxx - 物理删除文件,确保您有一个副本以便稍后添加

git add —all badfile.xxx - 在阶段

中将其标记为已删除

git checkout -b some_local_branch_we_ll_never_use - 在提交前创建一个新分支

git commit -m "Delete the bad file" - 提交并删除新分支中的错误文件,工作目录应该是干净的

git checkout my_good_old_branch - 回到你的工作分支,继续你的生活……

然后您可以删除您的测试分支:

git branch -D some_branch_we_ll_never_use

git status

我找到了可以帮助我解决这个问题的人,他认为这与锁定文件的其他进程有关。

为了验证这一点,我将我的存储库复制到其他地方,用 SourceTree 打开它,我能够毫无问题地完成发布。

因此我猜这与文件被锁定有关。

虽然我怀疑我的 IDE (PHPStorm),但我在关闭它时无法确定它,然后仍然有文件权限问题。 也许是 Dropbox(整个存储库都在那里),谁知道呢。但现在我至少知道了一个解决方法。