Using Git from the Terminal with Emergence

Once you have initialized the git repository per the documentation at the link below, use the following workflow for interacting with the virtual file system.

Push Changes to Git

##1. Make Changes in your Emergence Editor
Per usual, save your changes using the emergence editor at /develop until you want to commit them to github.

2. Push changes to the Disk

Navigate to

/git/status

Click VFS -> Disk (Virtual File System to Disk). Once you do that all of the changes that were made in emergence will be pushed to the disk so you can interact with them using git.

3. Start an authenticated git session through ssh

SSH into your server and navigate to the git directory of the install you’re working on.

/emergence/sites/SITE/site-data/git/REPO-NAME/

Make sure you’re interacting with the file system as www-data

sudo su -l www-data -p

Now manually set your git ssh key using the following format:

export GIT_SSH=../REPO-NAME.git.sh

That’s it, you can now interact with git just like on your local machine.

Pull Changes from Git

So if you want to pull changes from git into your virtual file system, use the following process.

##1. Start your git session

Use the step 3 above.

##2. Make changes in git

Pull, merge, do what ever you need to do with git.

##3. Pull changes from Disk to VFS

Once you’re ready to push the changes you made using git to the virtual file system, navigate back to:

/git/status

Click Disk -> VFS to pull the changes from the disk to the virtual file system. You should see the updates in the recent activities folder.

1 Like

I just merged a new command, emergence-git-shell into the kernel: https://github.com/JarvusInnovations/Emergence/pull/33

Once the latest kernel has been installed, you can invoke it from anywhere to open a fully-configure git shell for a given site and git layer id:

sudo emergence-git-shell mysite mylayer

The command must be run with sudo so that it can switch into the emergence server’s user and read it’s configuration. To enable developers to use this command without granting full access, you can instead add them to your emergence server’s group and then enable users in that group to run just that command via your sudoers file with visudo:

%www-data       ALL=(ALL) NOPASSWD: /usr/local/bin/emergence-git-shell, /usr/local/bin/emergence-shell