C. Hinsley

12 June 2023


In the previous post I gave instructions for installing Gerby on an AWS EC2 instance. Here I discuss what must be done immediately afterward to back up Gerby to a GitHub repository.

cd hello-world
# Delete internally contained git repositories; we want
# all changes to be tracked in a consolidated repository
# instead of within separate submodules.
rm -rf ./plastex/.git/
rm -rf ./gerby-website/.git/
rm ./gerby-website/.gitmodules
# Remove plastex and gerby-website directories from .gitignore
# so we can track changes therein.
sed -i '1d;2d' .gitignore
git add plastex gerby-website tags configuration.py document.paux
git commit -m "Flatten hello-world, plastex, and gerby-website into consolidated repository"
# Tell git who you are.
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

# There is already a remote origin -- we have to decouple.
git remote remove origin
# Add the new origin and get ready to push changes.
git remote add origin <https://github.com/><your GitHub username>/<GitHub repository name>.git
git branch -M main
#git push -u origin main
# Install gh. You may afterwards get a message about restarting
# a kernel or something. Just hit the escape key a few times till
# this goes away.
sudo apt install gh

# Log into GitHub. You'll get a few questions to answer; here are
# the appropriate responses:
###
# ? What account do you want to log into? GitHub.com
# ? What is your preferred protocol for Git operations? HTTPS
# ? Authenticate Git with your GitHub credentials? Yes
# ? How would you like to authenticate GitHub CLI? Login with a web browser
###
# Once you answer the last of those four, press Enter. You should get this
# error message:
###
# /usr/bin/xdg-open: 882: www-browser: not found
# /usr/bin/xdg-open: 882: links2: not found
# /usr/bin/xdg-open: 882: elinks: not found
# /usr/bin/xdg-open: 882: links: not found
# /usr/bin/xdg-open: 882: lynx: not found
# /usr/bin/xdg-open: 882: w3m: not found
# xdg-open: no method available for opening '<https://github.com/login/device>'
# ! Failed opening a web browser at <https://github.com/login/device>
#   exit status 3
#   Please try entering the URL in your browser manually
###
# This is because EC2 doesn't have a web browser installed. Just go to the
# browser on your computer and open github.com/login/device and paste the
# one-time code supplied just before this error message in bold-face font,
# then authorize the application. Then go back to the EC2 shell and press
# enter -- you're done authenticating!
gh auth login

# Push your changes.
git push -u origin main