Skip to content

Instantly share code, notes, and snippets.

@0test
Last active February 15, 2022 15:30
Show Gist options
  • Save 0test/89758f24a70b261043e43f3dff02b674 to your computer and use it in GitHub Desktop.
Save 0test/89758f24a70b261043e43f3dff02b674 to your computer and use it in GitHub Desktop.
1. Чек ключей
ls -al ~/.ssh
Если есть, нахуй всё и п. 3
2. Генерировать ключ
ssh-keygen -t rsa -b 4096 -C "[email protected]" с твоей почтой для гита
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa >> ~/.ssh/authorized_keys
3. публичный id_rsa.pub скопировать в настройках репозитория /settings/keys/ вставить в deploy key
ssh -T [email protected] тестим коннект.
4. В папке сайта
git init
git branch
Поставить свою ветку, пусть main (по дефолту у вас будет master)
git checkout -b main
Инициировать гит
git commit --allow-empty -m "initial commit"
Вставить свой путь к репо. Только SSH!
git remote add origin [email protected]:NAME/PACKAGE.git
Сопоставить ветку с удалённой веткой на гите
git branch --set-upstream-to=origin/main main
Сделать git fetch
5. Попробовать git pull
6. Если просит всякое и пишет что "У текущей ветки нет информации об отслеживании." - значит, ветки разные. Проверить, че как
8. Делать git pull. Всё.
9. Автоматический пулл после пуша
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Setup key
- run: set -eu
- run: mkdir "$HOME/.ssh"
- run: echo "${{ secrets.DEPLOY_PRIVATE }}" > "$HOME/.ssh/key"
- run: chmod 600 "$HOME/.ssh/key"
# Deploy
- run: cd ~/ПАПКА & git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment