2017-03-07 78 views
1

我要提交一個文件到Git倉庫本地爲我的樣本項目如何在本地提交Git文件?

失敗的嘗試提交文件在本地

Divyanshu (master +) asteroids $ git commit -m "Fire one bullet at a time" 

fatal: cannot lock ref 'HEAD': Unable to create 'C:/Users/Divyanshu/Desktop/dktop/focus/ 
Udacity/Git-hub/version-control/repositories/asteroids/.git/refs/heads/master.lock': 
File exists. 

Another git process seems to be running in this repository, e.g. an editor opened by 'git 
commit'. Please make sure all processes are terminated then try again. If it still fails, 
a git process may have crashed in this repository earlier: remove the file manually to 
continue. 

回答

2

遵循以下步驟:

  • 關閉所有Git終端或任何其他正在訪問該存儲庫文件的編輯器

  • 到這個路徑: C:/Users/Divyanshu/Desktop/dktop/focus/Udacity/Git-hub/version-control/repositories/asteroids/.git/refs/heads/master.lock

  • 刪除名爲master.lock

  • 文件在管理員模式下再次運行你自己的Git終端

那麼你應該嘗試再次commiting!