2012-08-07 119 views
14

我的一個git倉庫存在一個常量問題。我不斷收到以下錯誤:GIT:/.git/index.lock':文件存在

fatal: Unable to create 'v:/path/to/files/.git/index.lock': File exists. 

    If no other git process is currently running, this probably means a 
    git process crashed in this repository earlier. Make sure no other git 
    process is running and remove the file manually to continue. 

我曾嘗試:RM -f ./.git/index.lock按計算器上的另一個線程,但我每次都得到這個錯誤:RM:不能斷開鏈接`./.git/index.lock':權限被拒絕

當我關閉aptana(我在終端中使用git)時,我仍然無法刪除文件。

任何想法如何解決這個問題?

另一個要注意的是這個混帳回購協議是很慢的時候我偶爾會在其內提交(它允許每10名試圖左右我)

感謝

+0

它爲我 http://stackoverflow.com/questions/17916339/error-in-deleting-addind-file-from-appharbor-using-git-unable-to-create-f-git – Shailesh 2013-07-29 05:41:40

+0

您是否擁有超級用戶或root用戶對您正在使用的系統的訪問權限?換句話說,你擁有電腦嗎?還是你在公共電腦上,比如校園實驗室? – 2013-10-08 17:59:49

+0

這些命令適用於unix和osx系統。您可以轉到資源管理器中的index.lock文件並將其刪除。如果你沒有看到.git文件夾。您需要先在您的文件夾管理器中設置顯示隱藏文件 – Jinxi 2014-12-05 08:21:37

回答

3

問題結束了集錦,每次我跑這當我試圖犯它會導致這個錯誤飯桶。

我停止使用aptana studio,我不再有這個問題了。

+7

不使用不是我的解決方案... sry – Jinxi 2014-12-05 08:22:44

24

須藤命令:

sudo rm -f ./.git/index.lock 

這兩個錯誤都表明index.lock由另一個用戶擁有。以超級用戶身份運行rm,然後再次嘗試您的命令。你也可以考慮到true設置core.sharedRepository如果是這樣,其實你的回購情況:

core.sharedRepository

When group (or true), the repository is made shareable between several users in a group (making sure all the files and objects are group-writable).

When all (or world or everybody), the repository will be readable by all users, additionally to being group-shareable. When umask (or false), git will use permissions reported by umask(2). When 0xxx, where 0xxx is an octal number, files in the repository will have this mode value. 0xxx will override user's umask value (whereas the other options will only override requested parts of the user's umask value). Examples: 0660 will make the repo read/write-able for the owner and group, but inaccessible to others (equivalent to group unless umask is e.g. 0022). 0640 is a repository that is group-readable but not group-writable.

See git-init(1).

False by default.

+0

謝謝,我試圖sudo,我得到這個:sh:sudo:command not found。 另外我不知道如何以超級用戶身份登錄,本週我纔剛剛開始使用git。 – sluggerdog 2012-08-07 06:46:31

+0

我仍然有這個巨大的問題,每天當我嘗試我得到index.lock錯誤。我仍然得到sh:sudo:命令未找到,無法手動刪除文件,始終拒絕權限。有任何想法嗎?謝謝! – sluggerdog 2012-08-24 05:21:59

+1

@sluggerdog你在什麼操作系統上?另外,你如何運行git命令? – Christopher 2012-08-24 12:06:17

0

如果您使用Aptanta Git和其他git客戶端,如f.e.,您也會遇到此錯誤。 TortoiseGit。所以這個其他Git軟件可能會鎖定您的Git,使其無法用於Aptana。

0

這樣做:

RM index.lock

其次

git的復位

+1

如果OP無法刪除文件,rm將如何幫助?如果您只是建議OP不使用'-f'標誌,請解釋您爲什麼認爲這是解決方案。 – 2016-03-08 10:31:50

-4

如果您在Windows面臨着這樣的問題,下面的步驟幫助你.. 轉到特定的路徑即v:/ path/to/files /並啓用顯示隱藏文件,文件夾和驅動程序。 然後直接刪除git文件夾內的index.lock文件(以前會隱藏)

+1

問題是他不能刪除文件,而不是他不能。 – 2016-01-12 07:31:16

-4

在本地倉庫中搜索index.lock並刪除該文件。

+3

OP說他不能刪除它。所以你建議,也許他應該嘗試刪除它?沒有幫助。 – 2016-03-08 10:31:17

0

這可能是一箇舊回覆,但我希望這對下一個需要此解決方案的人更有用。

在Linux/Unix/gitbash/cygwin的,儘量

rm -f .git/index.lock 

在Windows命令提示符,嘗試:

del .git\index.lock 

希望幫助,我發現這個解決方案在這裏:fatal: Unable to create 'project_path/.git/index.lock': File exists.

+0

'rm'將不起作用,因爲它們沒有權限 - 因爲它由其他人擁有 - 除非你'sudo'命令。 *「我已經嘗試過:rm -f ./.git/index.lock按照stackoverflow上的另一個線程,但我每次都得到這個錯誤:rm:無法取消鏈接'./.git/index.lock':Permission denied」* – 2016-04-19 09:48:12

+0

sudo是唯一需要的項目是由其他用戶擁有,否則不會。所以這不是強制性的部分。 – krishnaisdinesh 2016-04-19 10:34:34

+0

它由別人擁有,專門由Aptana使用。 – 2016-04-19 10:35:40

0

在git 2.11.0版中,.git文件夾可能不包含index.lock文件。我想通過.git/refs/heads/文件夾中包含一個.lock文件並使用rm命令將其刪除。

也一定要殺死可能使用git repo使用ps -aef | grep gitkill -9的過程。