Introduction
GitHub is a developer platform that allows developers to create,store and manage their code.It provides access control,bug tracking and task management for every project. Git is a system used to handle everything from small to large projects. GitHub uses Git as its distributed version control.
Step by step guide
Creating a folder
- In your git version,type
pwd(print working directory)
pwd will basically tell you the absolute path for your directory.It is usually essential to know in order to be able to navigate to the right directory

From the image above,my pc path is from C to Users to HP
In order to navigate to the right directory we are going to run the cd command.Cd which stands for change directory will change your directory to your preferred directory.In this case we will cd to desktop where we store our files
In the Desktop directory we can now create a folder that we intend to push to GitHub.Git uses the command mkdir(make directory) to create a folder.Lets name the folder "My GitHub Project"
(When you check your File Explorer you will find a new folder named My GitHub Project)
We wish to create another folder 'data',this folder should be a subfolder inside My GitHub Project.To do this,we cd to the parent folder and then run the mkdir commandFor our GitHub project, we need a README markdown file that normally gives a brief explanation of what the project is about.It is usually the face of the project.To create a README file we run the command touch README.md
We want to add a brief description of what the project is about.
To add the description we are going to use the echo command,below is a screenshoot of how to write the command

NOTE:
We use a single greater sign to overwrite what we have in the README file and use double greater sign to add to what is in the file
Below is an image of what we've done till now

The cat(concatenate) command read files and print them directly as they appear
- To copy data that should be analysed we can run
cp ~/Downloads/MOCK_DATA.csvdata/
where
"/Downloads/MOCK_DATA.csv" is the source and data/ is the destination
Pushing to GitHub
We now have our folder and we can now push it to GitHub
Run the command git init that creates an empty repository in git,it allows git to start watching file changes,tracking history and managing branches
When you run the git init command the PC returns "Initialized empty repository..."We then run git status command,a command that shows what git sees
The PC returns "nothing added to commit but untracked files present"
We now run
git add .
git add prepares changes for the next commit
Now when you run
git commit -m "Add commit message"
Git now saves changes to the git repositoryThe next step is to check our branch and ensure its under main branch.If your run git branch and the PC returns master,then you have to rename it to main by running
git branch -m main
- Log in your GitHub and create a repository and copy your SSH key,then navigate back to your git version and the following commands
- You can finally run
git push -u origin mainand enter your GitHub passphrase to push to GitHub.


Top comments (0)