AppyPrinciplesGetting started
git's cheat sheet Push an app or ext

Via the appy make sub-command, you have created an Appy app or ext on your personal machine in some folder we will call localFolder.

Now, you want to push this code into a git repository. This page, based on this one from the Git book, explains how to to that.

I have created a tool named Hubber that I use to store and manage all my git repositories and my related software development projects. This tool is currently not published, but once it will be ready, be sure it will be published with a GPL-like open source license.

In Hubber, there is a notion of project. One project may contain several git repositories. Generally, one git repository is created for every app or ext.

So, I suppose here that you have created an empty git repository somewhere on a server. In the remainder of this section, the URL to this repo will be denoted by repoURL.

Configuring git

As a preamble, it is best to preconfigure git. For Appy, the name of the main branch of any git repository will be main.

Tell that to git by typing the following command:

git config --global init.defaultBranch main

⚠️ It is possible that, starting at some version of git, this step is not necessary anymore: main may have become the default branch name.

Preparing the app or ext's local folder

An Appy app or ext is a Python package, that may contain sub-packages as well. Within every such package, the Python interpreter will create a sub-folder named __pycache__, for storing Python bytecode. From the git point of view, these folders and their content is not significant and is not to be versioned. We want git to ignore it. In order to do that, place, in your app or ext' main folder, a file named .gitignore, with the following content:

**/__pycache__

Before converting your folder to a git repository, remove any __pycache__ (sub)folder that would be found in it.

Convert now your app or ext's local folder into a git repo:

cd localFolder 
git init
git add .
git commit -am "Initial commit"

You have now a local git repo. Then, connect it to your server repo.

git remote add origin repoURL 
git push origin main
git branch --set-upstream-to=origin/main main

Your code has been copied to the server repo.

Within localFolder, type the following command if you want to display the server URL to which your local git repo is tied.

git remote --v

Your should get a result like this:

origin    repoURL (fetch)
origin    repoURL (push)