![](/img/trans.png)
[英]why the branch does not appear to be a git repository? it is not the master branch
[英]Why does my git bash always start at master branch?
我有一台安裝了 git 的 Windows PC。 每當我啟動 git bash 時,它總是站在/c/Users/_user
的master
分支,如下所示:
NativeKiwi@nkiwi MINGW64 ~ (master)
我認為它應該是這樣的:
NativeKiwi@nkiwi MINGW64 ~
我看了看周圍的人,發現他們在第一次開始使用 git bash 時沒有(master)
。 我用git remote -v
檢查了 git repo,但什么也沒有。
提示中顯示的字符串取決於您的PS1
環境變量。 請檢查.bash_profile或.bashrc以獲取PS1環境變量的配置。
我在錯誤的目錄中遇到了同樣的問題(由於運行git init
)並通過在該目錄中運行rm -rf .git
來修復它。
您看到 master 是因為您使用git init
命令在當前路徑創建了一個 git 存儲庫。 始終在包含項目文件的文件夾中創建 git 存儲庫。 考慮運行rm -rf .git
命令。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.