Possible to code locally and push to glitch with git?

Updated to use the new Git access tokens (and later to reorder the URLs):

I think I read this backwards the first time. You can do most of what you want right now. Go to the Advanced Options menu in your project, and you’ll find the Git URL for your project, and a button that will copy your secret Git access token. You’ll be able to clone public projects with just the URL, but the token is needed to access private projects, and to get write access through Git.

If you want to push to Glitch, you can use command line tools to access your project from outside. You can use the first URL if you want read-only access.

git clone https://api.glitch.com/git/wealthy-tv
git clone https://<git access token>@api.glitch.com/git/wealthy-tv

Because the git repo in the container has a working directory, you can only push to it if your code is on a branch, so the workflow for pushing changes from the command line is git clone, create a branch, make changes, push:

git clone https://api.glitch.com/git/my-project my-project
cd my-project
git checkout -b mybranch
<make code changes and commit>
git push (the first time you’ll need “--set-upstream origin mybranch”, but git will remind you)

You can then go the console inside the Glitch project to check the changes and merge them:

git diff ..mybranch
git merge mybranch
refresh (so that editor updates)

Again, there is the manual step of merging in the project, but this gets you most of the way there.

22 Likes