💅 Copy & Paste 💅
🚨 This will wipe away any code in your Glitch project and replace it with the code from Github, and reload your project, every time you push to your repo's
main
branch.
- Go to the Glitch
💻 Terminal
and run the following:
git config receive.denyCurrentBranch ignore
cat << EOF > .git/hooks/post-receive
unset GIT_INDEX_FILE
git --work-tree=/app --git-dir=/app/.git checkout -f
refresh
EOF
chmod u+x .git/hooks/post-receive
- Go to
🧰 Tools
, thenImport / Export
, and click the[Copy]
button to copy ✨ your project's Git URL ✨ to clipboard.
-
Go to
⚙️ Settings
,Secrets and variables
, thenActions
, and click[New repository secret]
to add the following secret:- Name:
GLITCH_GIT_URL
- Secret:
✨ your project's Git URL ✨
(see previous step)
- Name:
-
Create a new Github Action, by committing a new file,
.github/workflows/sync.yml
:
name: Glitch Sync
on:
push:
branches:
- main
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Sync to Glitch Project
uses: wei/git-sync@v3
with:
source_repo: https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
source_branch: main
destination_repo: ${{ secrets.GLITCH_GIT_URL }}
destination_branch: master
That's it, that's the whole thing.