git 使用 gitlab repo 不允許我提交

git 使用 gitlab repo 不允許我提交

非常奇怪的情況,作業系統是在 Mac 內的 vagrant 中運行的 Linux,我有 ssh 連接到 gitlab。

我已經從 master 分支出來了

git checkout -b TB-2105_update_mfa

我更改了一些文件,執行 git status

On branch TB-2105_update_mfa
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   src/components/Admin/Users/Details.js
    new file:   src/components/Admin/Users/MultifactorAuthentication.js

例如,我執行某種形式的 git add

git add --all src

還要添加兩個更改組件的確切路徑。

我做了一個提交

git commit -m "Some message"

我做 git status

On branch TB-2105_update_mfa
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   src/components/Admin/Users/Details.js
    new file:   src/components/Admin/Users/MultifactorAuthentication.js

哪些特定的事情順序會導致提交不被註冊以及我該如何擺脫它。

我檢查了 master 並使用新名稱從它分支並嘗試添加、提交等,但仍然遇到相同的問題。

我還嘗試使用 --no-verify 進行提交,以防有一些我不知道的驗證。這些都不起作用。

我找到了一個強力解決方案,其中涉及將文件保存在其他地方、刪除存儲庫、將文件移回等等,然後一切就正常了。我想這已經足夠好了,也許我不會再遇到這種情況了,但不到 24 小時後我又遇到了這種情況!

注意到當我git diff這次這樣做時它是空的,即使更改的文件不是空的。但如果我這樣做,git diff --cached我就能看到改變。

相關內容