Skip to content

CREATE Web

This page provides instructions on how to run your first deployment from a GitHub repository, how to set up automatic deployments (updating the website every time you push to GitHub), as well as some general help for users who are new to git.

Tip

New to git? See the last chapter about how to set up your repository.

First deployment from a KCL GitHub repository

Info

By default, it is expected that your GitHub repository has the website's contents in a folder called /public. An example site is available here.

Furthermore, the deploy key is necessary even if your repository is public.

If you have an existing repository on github.kcl.ac.uk, you can deploy it in the following way:

  • First, on Portal, navigate to the website's page (project -> Resources pane -> View button), and copy the Public Key
  • Navigate to the your repository and click settings
  • Select "Deploy keys" and click "Add deploy key"
  • Paste the deploy key from Portal
  • Back on the project page, click Deploy next to your website, and fill out the popup:
    • Upstream repository: git@github.kcl.ac.uk:<username>/<repo>.git
    • Upstream revision: main
    • Public folder: /public
  • Finally, click Deploy

Automatic deployments

For websites that you plan to update or develop further, you may want to set up automatic deployments via a webhook:

  • In your repository's settings, click "Webhooks" and then "Add webhook"
  • In Portal, click "Generate a new webhook URL" and paste the URL into "Payload URL"
  • Leave everything else, and click "Add webhook"

Once that is set up, your website should be updated every time you push to your repository.


Introduction to Github

To create a repository

You can sign in to our Github using your King's account (kxxxx) at https://github.kcl.ac.uk/ Once signed in, you can click "new" to create a new repository, give it an identifiable name and click "Create repository". If creating a new site from scratch you may wish to tick "Initialize the project".

Next steps

Once you have your repository setup, you will want to checkout to your local machine. How you do this will depend on your operating system and personal preferences (GUI vs CLI).

Setup your local machine - Windows / GUI

To sign into Github Desktop

  • Go to File->Options->Accounts. Under "Github Enterprise" click "Sign in".
  • Type "https://github.kcl.ac.uk" and click "Sign in via web browser".
  • Login using your KCL account details (kxxxx and your password).
  • Click "Authorize github-enterprise".
  • If prompted to "Open githubdesktop.exe" click "allow".

To clone a repository (windows)

  • Click File->Clone a Repository.
  • Click the "Github Enterprise" tab and select the repository you wish to clone.
  • Select an appropriate local path and click "Clone".

To deploy changes (windows)

As you make changes to your website, you can commit them within the Github Desktop application. You need to enter a description for each change, but this is only really for you to refer back to later. If you have committed local changes, there will be an option to "Push origin", click this to push changes up to Github and deploy the changes to our servers.

Setup your local machine - Linux / CLI

SSH key

  • Go to https://github.kcl.ac.uk/settings/keys.
  • Follow the instructions for "generating SSH keys" (ssh-keygen -t ed25519 -C "your_email@example.com").
  • Click "New SSH key" and paste in the public key you generated.

To clone a repository (linux)

  • git clone git@github.kcl.ac.uk:USERNAME/REPO.git

To deploy changes (linux)

  • git add --all
  • git commit -am "COMMIT MESSAGE"
  • git push