3.4 Final Test!
If you’ve set up your SSH keys alright, we can try going ahead and seeing whether you can push and pull from GitHub successfully. If you’re going the HTTPS route due to issues, no worries! Just make sure your switch out the SSH clone URL for the HTTPS clone URL.
This is something we’ll do during the workshop as well, but trying it out beforehand reduces chances of errors while the course is ongoing.
The sequence of steps is as follows:
Create a test repository on GitHub.
Clone the test repository.
Make local changes.
Push the local changes to GitHub. This is where the magic happens (or not)!
If all went well, you can refresh the webpage with your GitHub repository and you’ll see your local changes.
Make changes online.
Pull the online changes to your computer, so your local repository is up to date.
If all went well, then your online changes are available locally as well. It also means you’re fully set up with Git & GitHub!
126.96.36.199 Create a test repository on GitHub
Log into GitHub.
Click the green New (repository) button.
You can name your repository as
Make sure it’s a Public repository.
Click YES, when asked if you want to initialize the repository with a README.
Click the green Create repository button.
Copy the SSH URL for cloning via the green Clone or Download button.
188.8.131.52 Clone the test repository
Go to your terminal and type the following command, substituting the SSH clone URL you copied in the previous step after
@github.com:username/testrepo.gitgit clone git
This should create a local copy of your repository as a folder with files contained within.
184.108.40.206 Make local changes
Navigate to the folder of your repository and open the README file. Make an edit, such as This is a line I’m adding offline to my local copy. Save the file and close it.
220.127.116.11 Push the local changes to GitHub
Go to your terminal and type the following command(s):
git add .
This adds all changed files to a ‘staging area’.
-m "insert-understandable-message-here"git commit
Now you’re officially ‘committing’ the changes you made. You want to add a understandable commit message so you have a clear record of your changes.
With this command, you push the local changes and commit message to your repository online.
This is where errors can pop up if the SSH set-up didn’t go as smoothly as expected. Troubleshoot the error messages the best you can!
If everything went smoothly, you can refresh the webpage with GitHub repository and you should see that your changes have been synced.
18.104.22.168 Make changes online
Now we want to go the other way around, open your README file on GitHub and make an edit online. You can do this by:
Clicking on the README file and the pencil icon to open edit mode.
Add a sentence to your README like This is a line I’m adding from GitHub.com.
When saving, you’ll have to provide a meaningful commit message again.
22.214.171.124 Pull from GitHub
Now go to your terminal and type the following command:
If all goes well, you’ll see some activity in the terminal which suggests the changes are being downloaded. You can then check out your README file and see whether your online change has been synced.