使用Git命令时出现fatal: this operation must be run in a work tree提示,该如何解决
生活随笔
收集整理的這篇文章主要介紹了
使用Git命令时出现fatal: this operation must be run in a work tree提示,该如何解决
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
我的問題是這樣的,我在idea中的terminal中使用git命令時出現fatal: this operation must be run in a work tree這樣的提示,任何命令都不可以使用,當時網上百度了很多,發現都沒有效果,所以又仔細的檢查,發現的出現該問題的原因:
剛開始錯誤時的代碼(在terminal內):
C:\jinshu\develop\projects\freamwork\.git>git status fatal: this operation must be run in a work tree C:\jinshu\develop\projects\freamwork\.git>git add . fatal: this operation must be run in a work tree C:\jinshu\develop\projects\freamwork\.git>git pull fatal: this operation must be run in a work tree后來發現問題是在于項目地址不對
錯誤地址:C:\jinshu\develop\projects\freamwork.git>
正確地址:C:\jinshu\develop\projects\freamwork\java>
更改地址的方法:
左上角file ==> Settings ==> Tools ==> Terminal ==> Start directory
沒有更改地址前發現地址就是正確的,于是又重新選擇一遍地址,然后點右下角apply ==> ok
然后點local的x號關閉窗口,再重新打開,這樣就更改成功了。
總結
以上是生活随笔為你收集整理的使用Git命令时出现fatal: this operation must be run in a work tree提示,该如何解决的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在springboot中使用easyex
- 下一篇: easyexcel中的常用注解