본문 바로가기
DevOps/Git

[해결 방법] fetal: bad source

by HJ0216 2023. 1. 19.

발생 Error

Git Bash에서 다음 명령어를 입력할 경우,

$ git mv Machine_Learning ai
fatal: bad source, source=Machine_Learning, destination=ai/Machine_Learning

fetal: bad source

Error 발생

 

 

 

Error 원인

1. 동일한 폴더 이름을 대소문자만 변경하는 경우

2. 변경이 필요한 file name을 잘못 지정한 경우(⭐)

-> ai로 이름이 변경되어 Machine_Learning이라는 폴더가 없음에도 바꿀 대상으로 Machine_Learning을 지정

-> git status를 입력하니,

On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        renamed:    Machine_Learning/ann_model.py -> AI/ann_model.py
        renamed:    Machine_Learning/useful_method_from_numpy.py -> AI/useful_method_from_numpy.py

이미 폴더명이 AI로 변경되어 Changed to be committed된 상태였다.

 

 

해결 방법

수정사항 없이 다음 단계 이동

git add .
git commit -m "change the folder name"

 

 

 

참고 자료

📑 [Git] 폴더명 변경사항 반영하기