[Git] "fatal: could not read username for no such device or address" 해결
2024. 11. 20. 03:16ㆍ프로그래밍/Git
Colab에서 모델 학습을 위한 프로젝트 clone 도중 마중한 에러이다.
내로라 하는 방법은 모두 시도해보았으나 다 실패하였다.
1. osxkeychain -> 애초에 colab 실행 환경이 osx가 아니어서 그런지 명령어 실행이 잘안됨
2. git config 설정
git config --global user.name {your_name}
git config --global user.email {your_email}
역시 설정 이후에도 같은 에러 발생
3. git remote origin 명시적 설정
git remote add origin https://{username}:{password}@github.com/{username}/project.git
git remote set-url origin https://{username}:{password}@github.com/{username}/project.git
위 두가지로 remote를 나의 repository로 명시적으로 설정했음에도 되지 않음
이쯤에서 생각해봤을 때 해당 에러가 왜 발생하는지 생각해봤다.
발생 가능 원인
1. private repository라서 비밀번호로 접근을 못한다.
2. 1번과 관련된 모종의 이유로 access token이나 비밀번호로 바로 clone을 해야 하는데 CLI상에서 user name이나 password를 요구하는 질의를 받았기 때문이다.
따라서 access token을 통해 clone을 받는다면 가능할 것 같았다.
추가로 SSH 방식은 사용하지 않은 이유가 클라우드 환경에 찝찝함을 남기기 싫었으며 아직 코랩을 별로 사용하지 안해봤던 터라 세션 종료나 새 파일의 경우 매번 그러한 설정을 해준다면 정말 귀찮을 것 같았기 때문이다(실제로 그런지는 모름).
해결한 방법
!git clone https://git_token@github.com/username/repository.git
위 방법을 사용해 정상적으로 clone에 성공하였다.
'프로그래밍 > Git' 카테고리의 다른 글
Git stash로 다른 브랜치에 로컬 변경사항 옮겨서 적용하기 (0) | 2023.11.22 |
---|---|
[Git] fast forward, rebase, merge, pull, checkout, switch, HEAD 등에 대한 개념 (0) | 2023.11.09 |