GitHub

From DRMF
Jump to navigation Jump to search

SSH keys

  • These steps only need to be done once
  • If you don't have a private-public ssh key authentication setup then generate a private key and upload it to GitHub
  • Run ssh-keygen
  • Display the public key by executing cat ~/.ssh/id_rsa.pub
  • Copy all of the code and paste it to your GitHub -> Settings -> SSH keys, namely https://github.com/settings/keys. Do this by hitting New SSH key button.

Establishing Connection

Set up git username and email

  • These steps only need to be done once
  • Make sure to do this before you do your first commit otherwise you will have problems
  • Run git config --global user.name "YOUR NAME" to set the author's name
  • Run git config --global user.email "YOUR_EMAIL@example.com" to set the author's email
  • Run git config --global core.editor "vim" to set the author's editor

Setup link to upstream

  • These steps only need to be done once
  • cd into folder of commitment (e.g., ~/DRMF-Seeding-Project)
  • Run git remote add upstream git@github.com:DRMF/DRMF-Seeding-Project.git
  • Run git fetch upstream

Changing Content

  • cd into folder of commitment (e.g., ~/DRMF-Seeding-Project)
  • git pull upstream master to check in modified files from the master branch
  • You can create any new directories for your project if necessary inside the downloaded GitHub directory
  • Files you are uploading to the GitHub repository must be in the directory - copy them over from elsewhere

Committing

  • git status to tell you what you changed
  • git add -A to add everything which has been modified, created or deleted for the next commit
  • git commit this commits all files which have been added using git add
  • git commit --amend if you want to modify the commit message
  • git push origin master

Creating Pull Request

  • Go to your repo and click on New pull request button
  • Confirm by clicking on Create pull request button, add comment if you like, and then click on Create pull request button
  • Wait until the tests have been passed
  • If there is a green button with all checks have passed, then ask someone to merge the pull request
  • Otherwise, follow the instructions to resolve the conflicts or failed tests
  • If you get stuck, then write a comment there

Merging Pull Request

  • First review the changes by clicking on Files changed
  • If you are happy then click on Conversation, scroll down, then click on Merge pull request button