Files
openclaude-LLM-local/docs/github-auth-remotes.md
T
2026-04-21 15:37:43 +10:00

51 lines
2.0 KiB
Markdown

# Git: GitHub, PAT, `gh` и remotes
Практичные способы не вводить пароль на каждом `git push` и нормально работать с `gh`.
## 1. Рекомендуемый путь через GitHub CLI
```bash
gh auth login
gh auth status
```
Удобно для GitHub: одна авторизация и нормальная работа `git pull`/`git push` и `gh`.
Если **`gh repo view`** или API в другой среде (CI, удалённый агент) возвращают ошибку про отсутствие репозитория, хотя у вас локально всё ок — см. [openclaude-with-repositories.md](openclaude-with-repositories.md) (раздел «Частые ошибки», подраздел про GitHub CLI).
## 2. Через PAT по HTTPS
1. Создать Personal Access Token на GitHub (минимальные нужные scopes).
2. Проверить, что remote в HTTPS:
```bash
git remote -v
git remote set-url origin https://github.com/OWNER/REPO.git
```
3. Включить credential helper, чтобы не вводить PAT каждый раз:
```bash
git config --global credential.helper store
```
4. Выполнить `git pull` или `git push` и один раз ввести логин + PAT.
## 3. Через SSH (альтернатива PAT)
```bash
ssh-keygen -t ed25519 -C "you@example.com"
# Добавьте публичный ключ в GitHub account settings
git remote set-url origin git@github.com:OWNER/REPO.git
```
SSH обычно удобнее для постоянной работы с приватными репозиториями.
## 4. Подробности и типовые проблемы SSH
- [github-ssh-setup-and-troubleshooting.md](github-ssh-setup-and-troubleshooting.md)
## 5. OpenClaude и репозитории (потоки разработки, RAG с кода)
- [openclaude-with-repositories.md](openclaude-with-repositories.md)