형상관리/git

[에러] git Remote does not have refs/heads/ㅁㅁ available for fetch. 에러 해결 (이클립스)

수키 💻 2022. 2. 25. 11:29
반응형

 

[에러] git Remote does not have refs/heads/ㅁㅁ available for fetch. 에러 해결 (이클립스)

 

✔ 환경

Windows 10

eclipse 2021-12

 

 

 

Pulling 1 repository
Remote does not have refs/heads/ㅁㅁㅁ available for fetch.
Remote does not have refs/heads/ㅁㅁㅁ available for fetch.

 

 

✔ 현상

pull 받으려고했는데 사진에 보이는 branch를 fetch 할 수 없다고 오류가 떴다.

내가 pull 받으려는 branch는 js.lee_2948 branch가 아니었는데도 해당 오류가 떴다. (이클립스, 소스트리에서 동일하게 안됨)

 

 

✔ 원인

github상에서 확인해보니 js.lee_2948 branch는 이제 삭제된 상태였고 내 로컬 및 리모트에는 남아있는 상황

이미 없는 branch인데 한꺼번에 다 pull을 받으려고하니까 해당 오류가 발생했다

 


 

✔ 해결

1. 해당 로컬 branch를 제거하기 (이클립스 혹은 소스트리 이용)

- 이클립스 Git Repositories (Perspective) 

Perspective Git Repository

- 해당하는 Git Repository > Branches > Local > branch 우클릭 > Delete Branch

2. 해당 Remote Branch 제거하기

- 이클립스와 소스트리에서 그냥 제거시에 제거가 안되고 오류가 떠서 명령어로 제거

(실제 해당 branch가 지워져있기에 제거됨)

git remote prune origin

prune 은 remote 의 것을 지우는 것이 아닌, local 에서 remote 를 ref 하는 것 중 유효하지 않은 것을 제거하는 작업이다

 

<참고>

--dry-run --verbose : 실제 수행은 X, 시뮬레이션

git remote prune --dry-run --verbose


3. 해당 Repository Properties 수정

- 2번까지하면 될줄알았는데... 안됐다 😂 Properties에서도 제거해줘야 제대로 동작한다

 

git repository 우클릭 > Properties

 

Configuration > remote > 유효하지 않은 fetch선택 후 Remove

 

 

이렇게까지하고 pull받으면 정상적으로 동작된다.

 

 

 

Reference
https://aroundck.tistory.com/6529

 

 

반응형