Practical Use Of GitHub In A School Computer Lab
Tags: github, beginners, tutorial
Published: 2020-10-24 11:57:00

###### 🚀 Sum-up: This beginner tutorial helps you practically set up your GitHub in a school lab or personal computer so that you can seamlessly continue working on your code on multiple devices.

# The Problem 👎
In a school computer lab, at least at my college, your files are saved on the computer's local drive, hence to return to working on your precious code, you need to always use the same computer. This can be really inconvenient when someone else is using it or when you want to continue working on your code at home on your personal computer. 🤦‍♂️

# The Solution 🏆

*Note: I won't waste your time, what I'm about to show you can kind of easily be done by uploading your files to [Google Drive](https://www.google.com/drive/) or a similar service.* 

My solution, like others I'm sure, is to use GitHub to host my code online. This allows me to use any computer I want, I simply clone the repository and keep working. When I'm done, I push the changes back up to GitHub and that's it! 🎊

**I had a hard time getting all of this done when I was a new to programming**, so I decided to make this super beginner tutorial to help out anyone with the same trouble.

## Prerequisites
✅ Have a [GitHub](https://github.com/) account setup and ready to go. Some knowledge on what it is and why you need it will be helpful.
✅ Download and install GitHub desktop app on your computer. [Download Here](https://desktop.github.com/)
✅ Login to GitHub Desktop, should look something like this (you may or may not have repositories yet, so don't worry about that):
![Startup Page](https://dev-to-uploads.s3.amazonaws.com/i/wm0ix0om4qo44gqt0ed3.png)



## Use Cases:
Depending on where you currently have your code files, decide on which of these two camps you belong to, and read the relevant part of the tutorial:
1. [I have the files on my computer.](#onComputer)
2. [I have the files on GitHub.](#onGithub)

*Note: Because most people use a Windows OS, these pictures show a Windows UI. The steps on macOS are the same though.*

### Case 1: **I Have The Files On My Computer** <a name='onComputer'></a>

#### Step 1: 
* Click on **_File_**, then **_Add Local Repository_** as shown below:
![On Computer Step 1](https://dev-to-uploads.s3.amazonaws.com/i/0h6t39ysjxi38xi9t634.png)

Note: there may be a different, maybe even better, way of doing this but whenever I use the _New Repository_ option, the app just doesn't get the path right at all! 🤦‍♂️

#### Step 2: 
* On the dialogue popup (left side), click **_Choose_** so you can select the folder with the code.
* A screen like the one on the right will show up. Navigate to the folder with your code and select it as shown (right side). In my case, the folder is _Code Files_ in my _Documents_ folder. Click **_Select Folder_** when done.

![On Computer Step 2](https://dev-to-uploads.s3.amazonaws.com/i/vqpps06q2q42uuni17g3.png)

#### Step 3: 
* A dialogue like in the image below will show up, don't worry, just click **_create repository here instead_** .
![On Computer Step 3-1](https://dev-to-uploads.s3.amazonaws.com/i/txw5gmkpng31ypfv6k7e.png)

* A new dialogue similar to the one below will show up. Fill in the rest of the details as desired, then click **_Create Repository_** . Options such as  Git ignore and License are outside the scope of this tutorial.
![On Computer Step 3-1](https://dev-to-uploads.s3.amazonaws.com/i/9uhh8jvk92kko9vmlw5n.png)

#### Step 4: 
* The folder with your code should now have some new, possibly hidden, files in it created by the GitHub app. These allow it to track any changes you make to the files so you can push them online.
* Your screen should look similar to the one below. In my case, the folder only had one file called _HelloWorld.java_ .
![On Computer Step 4](https://dev-to-uploads.s3.amazonaws.com/i/u5sn3127g9m9dkoqs3sn.png) 
* Click **_Publish Repository_** when done. 


#### Step 5:
* On the popup below, add the name and description to be used on your GitHub account. 
* Check the **_Keep this code private_** box if you don't want anyone seeing this code.
* When done, click **_Publish Repository_**
![On Computer Step 5](https://dev-to-uploads.s3.amazonaws.com/i/3lytbuhiu0t1an2o70rk.png)

* Congratulations, your code is now ready on GitHub! 🔥 You can login and view it there.


#### Step 6:
* Try making a change to any of the files. Those changes should show up on the GitHub app, and you can push those changes too. 
* Add your summary and description of the new code (bottom-left corner), these will be useful when tracking the changes later on.
* Click **_commit to main_** afterwards.
![On Computer Step 6](https://dev-to-uploads.s3.amazonaws.com/i/giinyf4lba9e8w80uwna.png)
* This time around, Click **_Push Origin_** on the screen that follows.

PS: **Never forget to push changes!!** ⛔



### Case 2: **I Have The Files On GitHub** <a name='onGithub'></a>
This is useful if you already have the files on GitHub and you want to continue working on them on a different computer.

#### Step 1:
* Click on **_File_**, then **_Clone Repository_** as shown below:
![On GitHub Step 1](https://dev-to-uploads.s3.amazonaws.com/i/nq27j4izuum5y9813pih.png)


#### Step 2:
* In the screen below, you should be able to see the repository you want. If not, try using the filter option to help you find it.
* If you want to change where this repository is cloned to, click **_Choose_** next to Local Path shown at the bottom.
* Click **_Clone_** when done.
![On GitHub Step 2](https://dev-to-uploads.s3.amazonaws.com/i/qxp6aoc9r061zgn2aa9q.png)

#### Step 3:
* A screen like the one below should show up. You can now view it in your file explorer by clicking **_Show In Explorer_**
* You can go on to open this folder on your IDE and whatever edits you make will show up on the app. From there, follow step 6 of the previous section.
![On GitHub Step 3](https://dev-to-uploads.s3.amazonaws.com/i/661qziwubofdlalbg30r.png)



# Summary 🏁

There is much much more you can do with the GitHub desktop app and the web interface. It is particularly useful when contributing to open source projects, version control and collaborating with other programmers remotely. 💯 You can now go on to exploring more operations such as using different branches, forking a project and so on.

Don't hesitate to let me know if you need any help with this content. 👋🚀