Newbie's guide to Anvil and Git/Github

step 0 - you can use the same public ssh for all your ssh needs if you wish.

step 1 - origin just means original - so the original remote you cloned.

step 2 - <name> - whatever you choose like anvil_prod
          - <url> - the url of your remote
e.g.
the bit with ssh://
Screen Shot 2020-04-09 at 06.50.12
or
Screen Shot 2020-04-09 at 06.49.22

so above I would do:

$ git clone ssh://stucork%40gmail.com@anvil.works:2222/ABCDECF312WJFOK2.git Tabulator
# this is origin (anvil_dev)
$ git remote add anvil_prod ssh://stucork%40gmail.com@anvil.works:2222/TGQCF3WT6FVL2EZ2.git
# this is a separate anvil app for production
$ git remote add github https://github.com/s-cork/Tabulator.git
# github remote

Anvil already automatically has/is a remote

yes - your anvil apps are all remote git repositories with urls that you can use to access them.
When you push and pull from your anvil remote you’ll either need to have set up ssh or use your anvil email and password.

(Though i’ve never used it with emails and passwords so I can’t speak to any authentication issues.)


with an anvil git workflow rather than having branches in your anvil app - like you would typically do in github or on your local machine - you should think about each anvil app as it’s own branch. The reason being - (unless i’m mistaken) the branch you are working on in the IDE is always the master branch.

You can check this by doing

print(app.branch) 

when you run your anvil code


edit: for pushing - in vs code i typically do this… in order to specify which remote to push to

Screen Shot 2020-04-09 at 07.39.06

the incantation would be:

$ git push <remote-name>

if you don’t specify a remote name it will default to origin

2 Likes