Creating and uploading a Python project to Github

Caesar Cipher Header

Having recently attended BSides London 2018 I’ve become more conscious of where my skills fall short and more determined to increase them. An area I’m particularly determined to improve is my programming skills.

One of the subjects I did at A-Level was computing where I we were tasked with creating a program in Pascal. Pascal was not widely used then and probably less so now (it does not appear within the fifteen most popular languages on Github’s yearly Octoverse report). In my spare time had a play around with C# and a tiny amount of Visual Basic.

While I believe I have at least a basic understanding of the concepts of programming, in terms of practical use my skills are in need of some serious polishing, cue my Caesar Cipher Python project. If you’re unaware of a Caesar Cipher it was allegedly used by Julius Caesar and is a substitution cipher that changes a letter of the alphabet for another letter a number of letters down the alphabet and is contemporarily used in the ROT13 cipher.

The Project

To get started on the project I used the Caesar Cipher walkthrough on Code Club which gives you a basic guide to create a cipher that can easily transpose lowercase characters and not fail when letters are chosen as the input. After creating this basic project, I then added code to transpose upper case letters of the alphabet and also added the ability to change the number of places the letter is shifted (the key).

With my cipher created I then wanted to upload my project to my Github using the command line as much as possible. After looking around the first step appeared to need to be done on the Github website.

Create a github repository

With this done I switched back over to the command line. One thing I wish I’d done at the start of the process is edited my git config file in my home directory, so if you are looking to do this, make sure this is edited by typing

$ nano ~/.gitconfig

adding the name and email you use on Github.

Navigating to the directory with my project in using the cd command, I then initialised it as a git repository with

$ git init

the walkthrough I initially followed advised to not create the README or gitignore files to minimise issues as they could be added later, so didn’t create these. I was then directed to add the files to the local git repository (if you’re on a Mac all these files will be hidden as they have a . in front of the folder name. An easy way to show hidden files is with command + shift + .) so entered the command

$ git add .

and then committed the files with

$ git commit -m “First commit”

Next I specified the URL of my repository with

$ git remote add origin

and verified this was correct with

$ git remote -v

Followed by the final push of the files with the command of

$ git push -u origin master

Github will then asked for my your username and password. This seemed obvious enough, however there is a slight complication if you have Two Factor enabled. For this you’ll need to create a personal access token (Github’s documentation walks you through this. When generating my token I only ticked the repo boxes and nothing else.) and use this as your password. With all the details entered my file was then visible on Github.