재테크 A2Z

Poetry 설치 후 GitHub 연동 시 발생한 에러와 해결 방법 (Windows 기준) 본문

코딩 & 파이썬

Poetry 설치 후 GitHub 연동 시 발생한 에러와 해결 방법 (Windows 기준)

a2ztec 2025. 5. 19. 19:21

Python 프로젝트에서 Poetry를 활용해 패키지를 관리하고 GitHub와 연동하는 과정에서 실제 발생한 문제들을 해결한 기록입니다.


📌 환경 구성

  • 운영체제: Windows 10 / 11
  • Python: 3.10 (※ Microsoft Store 설치 ❌, 공식 설치)
  • Poetry: 2.1.3
  • Git: Git for Windows
  • 에디터: Visual Studio Code

✅ Poetry 설치

powershell
복사편집
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -

Poetry 명령어가 안 먹힌다면?

powershell
복사편집
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:APPDATA\Python\Scripts", "User")

설치 확인:

bash
복사편집
poetry --version

🚨 오류 1: poetry new 실행 시 Python 경로 문제

lua
복사편집
Command '[...\\python.exe'] returned non-zero exit status 9009.

🔍 원인: Poetry가 Microsoft Store에 있는 가짜 python.exe를 참조

해결: Python 3.10.11을 공식 사이트에서 설치한 뒤, Poetry에 명시적으로 연결

bash
복사편집
poetry env use C:\Users\사용자명\AppData\Local\Programs\Python\Python310\python.exe

🚨 오류 2: poetry shell 안됨

csharp
복사편집
The 'shell' command is not installed by default...

해결 방법 1 (가상환경 수동 진입):

powershell
복사편집
poetry env info --path # 출력 경로 예시 # C:\Users\you\AppData\Local\pypoetry\Cache\virtualenvs\autobot-trader-xxxx\Scripts\Activate.ps1 & "해당경로\Activate.ps1"

해결 방법 2 (plugin 설치):

bash
복사편집
poetry self add poetry-plugin-shell poetry shell

🚨 오류 3: Git 명령 인식 안 됨

bash
복사편집
'git'은(는) 인식되지 않는 명령입니다

해결: Git for Windows 설치 후 git --version 확인


🚨 오류 4: GitHub 푸시 시 'Could not resolve host'

vbnet
복사편집
fatal: unable to access 'https://github.com/...': Could not resolve host: github.com

해결:

  • 인터넷 연결 / 방화벽 확인
  • git remote -v 확인 → 주소 틀렸으면:
bash
복사편집

🚨 오류 5: GitHub 인증 실패 (Username, Password)

makefile
복사편집
remote: Support for password authentication was removed...

해결: GitHub Personal Access Token (PAT) 사용

  1. GitHub Token 발급 페이지 접속
  2. "Generate new token (classic)"
  3. 권한 체크: repo, read:org
  4. 생성된 토큰을 비밀번호 자리에 붙여넣기

🚨 오류 6: 인증창 127.0.0.1 ERR_CONNECTION_REFUSED

해결:

  • PowerShell 재실행 후 git push 재시도
  • 브라우저 인증 실패 시 → PAT 방식으로 전환

✅ 마무리: GitHub 푸시까지 성공한 상태

bash
복사편집
git init git remote add origin https://github.com/사용자명/저장소명.git git add . git commit -m "🎉 Initial commit" git push -u origin main

📁 최종 프로젝트 구조 예시

autobot-trader/
├── .gitignore
├── README.md
├── pyproject.toml
├── poetry.lock
├── src/
│   └── autobot_trader/
│       ├── __init__.py
│       └── main.py
└── tests/
    └── __init__.py

Poetry + GitHub 연동의 핵심은:

  • 올바른 Python 경로 지정
  • Git 인증 방식(PAT) 이해
  • PowerShell과 환경 변수 설정