Skip to content

Instantly share code, notes, and snippets.

@anyadoc
Last active August 30, 2023 18:55
Show Gist options
  • Save anyadoc/377aa7231507377e0e1f2c909c94208e to your computer and use it in GitHub Desktop.
Save anyadoc/377aa7231507377e0e1f2c909c94208e to your computer and use it in GitHub Desktop.
GitHub: First steps

Aniruddha Belsare
Assistant Professor of Disease Ecology
Email: abelsare@auburn.edu
Website: https://avbelsare.netlify.app
Twitter: https://twitter.com/anyadoc


Step-by-step instructions for setting up a Github account

  1. Sign up for a new Github account: https://docs.github.com/en/get-started/signing-up-for-github/signing-up-for-a-new-github-account

The following links are from https://docs.github.com/en

Types of GitHub accounts: https://docs.github.com/en/get-started/learning-about-github/types-of-github-accounts

Choose Personal account - GitHub Free.


  1. Creating a new repository Login to your GitHub account. Click on the '+' in the top right corner and then click 'New Repository'.

Then follow the steps described here: https://docs.github.com/en/get-started/quickstart/create-a-repo


  1. Creating a folder in your repository

Click 'Add file' and then 'Create new file' from the drop-down list.


In the box 'Name your file...', type the folder name followed by a '/'. e.g. References/

A new box will appear after the / where you enter the file name. You must enter some text - e.g. filename.txt

Then click on 'Commit new file' and your folder is created!

Uploading files in this folder is straightforward: Click on 'Add file' and then select the 'Upload files' option from the drop-down list.


  1. Adding a file to the repository

https://docs.github.com/en/repositories/working-with-files/managing-files/adding-a-file-to-a-repository

Files that you add to a repository via a browser are limited to 25 MB per file. You can add larger files, up to 100 MB each, via the command line.

https://docs.github.com/en/repositories/working-with-files/managing-files/adding-a-file-to-a-repository#adding-a-file-to-a-repository-using-the-command-line


  1. Saving a repository maintained by another Github user with stars

See here: https://docs.github.com/en/get-started/exploring-projects-on-github/saving-repositories-with-stars

Follow these steps:

  1. Log into your Github account and search for the desired repository. The search window is in the top left corner of the page.
  2. This will take you to the main page of the repository maintained by the Github user. In the top-right corner of this page, click Star.

Starring makes a reporsitory easy to find later and also shows appreciation to the repository maintainer.


  1. Forking a repository

See here: https://docs.github.com/en/get-started/quickstart/fork-a-repo

Click Fork on the top-right corner of the main repository page.

Forking creates your copy of the repository, thus allowing you to freely experiment with changes without affecting the original project.


  1. Cloning a Github repository

Download Github Desktop: https://desktop.github.com/

Clone a Github repository with Github Desktop to create a local repository on your computer. The repository is stored in a folder titled 'Github' inside your Documents folder; alternatively, you can choose any location on your computer.

GithubD_clone

Read more here: https://docs.github.com/en/desktop/contributing-and-collaborating-using-github-desktop/adding-and-cloning-repositories/cloning-and-forking-repositories-from-github-desktop


  1. Uploading changes to Github Remember the order of execution: Pull, Fetch, Commit, Push
  • First, make changes to the code and save. This will save the changes locally.
  • Then, open Github Desktop. The very first thing to do is PULL. This literally pulls any changes other collaborators might have made before you Commit or Push anything to GitHub. Bad things will happen if you miss this step!

GithubD_Pull

  • Now, Fetch changes on your local machine by clicking the Fetch origin button.

GithubD_Fetch

  • Commit your changes by adding a commit comment in the text box (lower left) and then pressing Commit to main.

GithubD_Commit

  • Finally, Push your commits to Github for your collaborators to see. (Push origin button or click on Repository and select Push from the drop down list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment