GrepBoard/매뉴얼
605 편 ·

password authentication was removed 해결

·시험 환경 Ubuntu 24.04 (Docker) · git 2.43.0 · GitHub 공식 문서 기준 · 2026-10·시험 범위 ↓·6 단계

GitHub password authentication was removed 는 계정 비밀번호를 보내서입니다. 토큰을 비밀번호 자리에 넣고 저장된 옛 값은 git credential reject 로 지웁니다.

output
remote: Support for password authentication was removed on August 13, 2021.remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.fatal: Authentication failed for 'https://github.com/…/'

HTTPS 로 GitHub 에 push·pull 할 때 계정 비밀번호를 보내면 나오는 거절입니다. GitHub 는 2021년 8월 13일부터 Git 작업에 계정 비밀번호를 받지 않습니다. 비밀번호를 묻는 자리에 개인 액세스 토큰(PAT) 을 넣거나, 자격 증명 관리자·GitHub CLI 로 로그인하거나, SSH 로 바꾸면 됩니다. 토큰을 만들었는데도 같은 오류가 나면 거의 항상 어딘가 저장된 옛 비밀번호를 git 이 계속 보내는 경우입니다.

[1] 원격 주소를 봅니다. 주소 안에 옛 비밀번호가 들어 있으면 토큰을 만들어도 그 값이 계속 쓰입니다.

console
$ git remote -vorigin	https://user1:old-password@github.com/example-user/app.git (fetch)origin	https://user1:old-password@github.com/example-user/app.git (push)$ git remote set-url origin https://github.com/example-user/app.git && git remote -vorigin	https://github.com/example-user/app.git (fetch)origin	https://github.com/example-user/app.git (push)

주소의 사용자:비밀번호@ 부분을 지웁니다. 이 형태는 .git/config 에 평문으로 남고, 셸 기록·CI 로그에도 찍히기 쉽습니다. 주소가 git@github.com: 으로 시작하면 이 글이 아니라 SSH 쪽입니다.

[2] 개인 액세스 토큰을 만듭니다. GitHub 의 Settings → Developer settings → Personal access tokens 에서 만듭니다.

종류git push·pull 에 필요한 것
Fine-grained대상 저장소를 고르고 저장소 권한 Contents 를 읽기(pull)·읽기와 쓰기(push)로
Classic범위 repo

조직 저장소면 조직 설정에 따라 토큰 승인이 필요합니다(Fine-grained 는 관리자 검토 전까지 pending). SAML SSO 를 쓰는 조직이면 토큰을 그 조직에 대해 승인(authorize)해야 합니다. 만료일을 정해 두고, 만료되면 새로 만들어 [3]·[4]대로 바꿔 넣습니다.

[3] 저장된 옛 비밀번호를 찾아 지웁니다. git 이 다음 접속에 무엇을 보낼지는 git credential fill 로 그대로 볼 수 있습니다. 비밀번호가 찍히니 남이 보는 화면에서는 하지 않습니다.

console
$ git config --show-origin --get-all credential.helperfile:/root/.gitconfig	store$ printf 'protocol=https\nhost=github.com\n\n' | git credential fillprotocol=httpshost=github.comusername=user1password=old-password

토큰을 만들었어도 여기 password= 가 옛 비밀번호면 git 은 묻지도 않고 그것을 보냅니다. git credential reject 는 설정된 모든 도우미에게 그 항목을 지우라고 전합니다.

console
$ printf 'protocol=https\nhost=github.com\nusername=user1\n\n' | git credential reject; wc -c ~/.git-credentials0 /root/.git-credentials$ printf 'protocol=https\nhost=github.com\n\n' | GIT_TERMINAL_PROMPT=0 git credential fill; echo "exit=$?"fatal: could not read Username for 'https://github.com': terminal prompts disabledexit=128

이제 저장된 값이 없어 사용자 이름을 물으려 합니다(여기서는 GIT_TERMINAL_PROMPT=0 으로 묻기를 꺼서 실패로 보입니다). --show-origin 에 시스템 설정 파일의 manager 나 osxkeychain 이 보이면 같은 명령이 Windows 자격 증명 관리자·macOS 키체인 항목에도 닿습니다. Windows 에서는 제어판 자격 증명 관리자 에서 GitHub 항목을 직접 지워도 된다고 GitHub 문서가 안내합니다.

[4] 토큰을 넣고 저장 방식을 정합니다. 다음 push 에서 Username 에는 GitHub 사용자 이름, Password 에는 토큰을 넣습니다. 도우미가 있으면 그 뒤로는 묻지 않습니다.

도우미저장하는 곳
store~/.git-credentials 에 평문 — 아래 cat 처럼 그대로 읽힙니다
cache메모리 · 정한 시간 뒤 사라짐(cache --timeout=3600)
manager(Git Credential Manager)운영체제 보관소 · 2단계 인증까지 대신 처리
osxkeychainmacOS 키체인
console
$ cat ~/.git-credentialshttps://user1:old-password@github.com

위는 [3]에서 지우기 전 파일입니다. 공용 서버에서는 store 를 피하고 cache 를 씁니다. 메모리 보관이라 git credential-cache exit 이나 시간이 지나면 다시 묻습니다. 자기 PC 라면 GCM 이나 gh auth login(GitHub CLI · Git 작업 프로토콜로 HTTPS 를 고르면 자격 증명을 저장)이 토큰을 직접 다루지 않아도 되는 길입니다.

[5] 토큰 대신 SSH 로 바꿔도 됩니다. 키를 계정에 등록한 뒤 원격 주소만 바꿉니다.

console
$ git remote set-url origin git@github.com:<계정>/<저장소>.git

등록한 키로 ssh -T git@github.com 이 Permission denied (publickey) 를 내면 GitHub Permission denied (publickey) 해결로 넘어갑니다.

[6] 묻는 창이 아예 안 뜨면 비대화형 환경인지 봅니다. CI·cron·IDE 의 백그라운드 작업은 터미널이 없어 이렇게 끝납니다.

console
$ GIT_TERMINAL_PROMPT=0 git ls-remote https://github.com/example-user/private-repo.git; echo "exit=$?"fatal: could not read Username for 'https://github.com': terminal prompts disabledexit=128

이런 곳은 미리 도우미에 토큰을 넣어 두거나, 그 서비스가 주는 토큰(GitHub Actions 의 GITHUB_TOKEN 등)을 씁니다. 인증을 통과한 뒤 push 가 ! [rejected] 로 막히면 이력 문제입니다 — git push rejected 해결.

공식 근거: GitHub 변경 기록 — Git password authentication is shutting down · About remote repositories — HTTPS · Managing your personal access tokens · Caching your GitHub credentials in Git · git-credential · git-credential-store · git-credential-cache

#git#github#personal-access-token#credential-helper