Possible to code locally and push to glitch with git?


#1

Like heroku dev cycle?

Can glitch keep synced with a git repository?


#2

Yes. There are GitHub import/export options in the menus, but if you know what you’re doing with git you can do much more. Your container already contains a git repository, and you can run git commands from the command line, so you could set a remote and push to it from there. Glitch doesn’t automatically sync with a remote repo right now, so you would have to manually run the commands, or write some code in your project to push/pull regularly.


Control via VSCode
#3

I think I read this backwards the first time. This will become easier in the near future, but you can do most of what you want right now. You’ll have to get your user token from the JS console. Go to the network tab in the Chrome debugging tools when you’re on Glitch, and look for requests with authorization=<some uuid>.

If you want to push to Glitch, you can use command line tools to access your project from outside. You’ll need to use your user token to write to the repo. You can use the first URL if you want read-only access.

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

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/my-project/git 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.


Code locally, push to glitch via git?
Best methods for git in glitch
Get the container/Docker image of my glitch app
My machine will not `git push`?
#4

Is it possible to automate the merge?

Possibly within the node app I’m guessing?


#5

Yes, you could run the merge command from inside the app.


#6

More discussion here: Code locally, push to glitch via git?


#7

When i try to git push i get asked for a password. Since i “Log in with github” to glitch, i don’t think i have a password, do you know if there’s a standard one?


#8

Tim describes it in a reply to this thread.