Error: Cannot perform an interactive login from a non TTY device

pudding·2023년 1월 8일
1

깃랩에서 ci/cd 중 오류가 발생하였다. 실수로 깃랩의 레포를 처음 만들었을 때 상태로 돌려서 작업해놓은게 모두 날아간 상태였고, reset으로 되돌렸다. 근데 이번에는 갑자기 ci/cd에서 빌드중 문제가 발생했다.

<오류내용>

Using docker image sha256:834e339ef8cdc14e0e0c73ed3ad573743be3a7538fdc5282f2ae 
for docker:latest with digest docker@sha256:fde7a4a9b1ca994f7c5bfd62fb32c70fddbbfea43a1ea ...
$ docker login registry.gitlab.com -u $GITLAB_USER -p $GITLAB_PASSWORD
Error: Cannot perform an interactive login from a non TTY device
Running after_script
Running after script...
$ docker logout
Removing login credentials for https://index.docker.io/v1/
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1

구글링을 해도 별로 정보가 많지 않았고, 한글로 작성된 블로그들의 방법으로는 다 해결되지 않았다. 누군가에게 도움이 되길 바라며, 결론은 브랜치 protect 관련 문제였다.

long story short - if your branch is NOT protected, then your variable in GitLab should also be NOT protected. Otherwise (protected variable on non-protected branch) it will not work and you'll get docker login fail on abovementioned error message.

출처: https://github.com/JanMikes/gitlab-ci-push-to-gcr/issues/2#issue-552452892

확실한 원인 규명은 못했는데, 프로젝트 날린걸 복구하면서, 또는 날리면서..(?) 깃랩의 main브랜치의 protected가 풀린것같다.
settings-repository-protected branches 에서 브랜치를 protected로 설정해주면된다.
원래는 깃랩을 처음 시작할 때 기본으로 브랜치가 protected 되어있다고 한다.

profile
영차 영차 개발 공부 기록 하기

1개의 댓글

comment-user-thumbnail
2023년 10월 25일

와 저도 딱 같은 상황이었는데 테스트 브랜치를 protected로 바꾸니까 해결되었어요 진짜 감사합니다..!!!!!

답글 달기