Atlassian의 정책 변경(CHANGE-3222)으로 Bitbucket의 App Password가 폐기되었다. 기존 App Password로 인증하던 환경에서는 remote 접근 시 410 에러가 발생한다. 본 글은 API Token 전환 절차와, 그 과정에서 함께 점검해야 할 credential helper 설정을 정리한다.
증상
remote: CHANGE-3222 - Functionality has been deprecated
remote: App passwords are deprecated and must be replaced with API tokens.
fatal: unable to access '.../*.git/': The requested URL returned error: 410
HTTP 410 Gone은 해당 인증 경로가 영구적으로 제거되었음을 의미한다. 재시도로 해결되지 않으며, 인증 수단을 API Token으로 교체해야 한다.
1. API Token 발급
- Atlassian account → Security → API tokens에서 생성
- scope는 필요한 최소 권한(repository read/write 등)으로 한정
- 토큰 문자열은 생성 직후 한 번만 노출되므로 즉시 보관
2. Credential Helper 확인
기존 자격증명이 어디에 저장되어 있는지 먼저 확인한다. helper에 따라 제거 위치가 다르다.
git config --get credential.helper
| helper | 저장 위치 | 자격증명 제거 방법 |
|---|---|---|
store |
~/.git-credentials (평문) |
파일에서 해당 호스트 줄 삭제 |
osxkeychain |
macOS Keychain (암호화) | security delete-internet-password -s bitbucket.org |
manager |
Git Credential Manager | git credential-manager erase |
osxkeychain으로 알고 keychain을 확인했으나 항목이 없다면, helper가 store로 설정되어 자격증명이 평문 파일에 저장되어 있을 가능성이 높다.
3. 평문 저장(store) → Keychain(osxkeychain) 전환
store helper는 자격증명을 ~/.git-credentials에 평문으로 보관하므로, 토큰 전환을 계기로 암호화 저장 방식으로 변경하는 것을 권장한다.
# 평문 자격증명 파일 제거
rm ~/.git-credentials
# helper를 osxkeychain으로 변경
git config --global credential.helper osxkeychain
4. API Token으로 재인증
remote URL은 변경하지 않고, 인증 시 비밀번호 자리에 API Token을 입력한다.
git fetch origin
# Username: <Atlassian 계정 또는 x-token-auth>
# Password: <API Token>
Username 기준
- 계정 API Token → Atlassian 계정 이메일 / username
- Repository · Project Access Token →
x-token-auth
인증에 성공하면 자격증명이 keychain에 저장되어 이후 재입력이 불필요하다.
참고: 토큰을 URL에 직접 삽입하는 방식
git remote set-url origin https://<user>:<TOKEN>@bitbucket.org/<repo>.git
동작은 하지만 토큰이 .git/config, 쉘 히스토리, 로그에 평문으로 노출될 수 있어 권장하지 않는다. credential helper에 위임하는 방식이 안전하다.
정리
- App Password 폐기로
410발생 시 API Token 전환이 필수 - 자격증명 제거 전
credential.helper설정을 먼저 확인할 것 store(평문) 사용 환경은 이번 기회에osxkeychain(암호화)으로 전환 권장- remote URL은 그대로 두고 비밀번호 자리에 API Token 입력으로 마무리