1. 程式人生 > 其它 >git倉庫資料夾含有空格導致無法add

git倉庫資料夾含有空格導致無法add

技術標籤:Gitgit版本管理git倉庫

1.問題描述

在git倉庫中,筆者的某個資料夾含有空格,比如檔名為“Problem_637_ Average of Levels in Binary Tree”,在執行以下命令git add Problem_637_ Average of Levels in Binary Tree時便會出現圖中的報錯資訊。
在這裡插入圖片描述

2.解決方案

解決方法很簡單,只需要將需要add的資料夾名字使用雙引號包裹起來即可,如下所示:

git add "git add Problem_637_ Average of Levels in Binary Tree"