fatal: Not a git repository (or any of the parent directories): .git

來源:互聯網
上載者:User

 

第一次用git,遇到這個錯誤提示,原來是這樣的:

fatal: Not a git repository (or any of the parent directories): .git

This tells you that the directory you're in is not a git repository. Before you can add remote servers, commit things and so you must have a git repository created.

In a git repository there's a directory (which can be hidden) named .git. It contains metadata on the repository and all the data regarding the checked files.

To create it type git init in the directory you wish to have a git repository. Then you could add remote servers and perform operations on it.

 

1.fatal: Not a git repository (or any of the parent directories): .git

  出現這個問題後,發現其實是在本系統下沒有找到一個.git這樣的目錄,所以在終端下使用git --help命令,顯示了其主要的一些命令參數,發現一個參數是init:

2.init Create an empty git repository or reinitialize an existing one

  執行git init之後,然後再重新編譯,這個問題就被解決了。這裡要注意的一點是,和svn不一樣,svn不需要自己使用命令來建立自己的資產庫,而git需要自己使用命令手動建立,具體.git的位置和你在哪個目錄下執行命令有關。

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.