GitHub — Forking, Cloning, Pushing, and Pulling
In this post we are just going go over a basic run down about forking, cloning, pushing in Github!
What is Git?
- According to Kinsta. (2016, September 16). What Is GitHub? GitHubGit is a specific open-source version control system created by Linus Torvalds in 2005. Specifically, Git is a distributed version control system, which means that the entire codebase and history is available on every developer’s computer, which allows for easy branching and merging. Kinsta, inc. (2016, September 16). What is Github? A Beginner’s Introduction to GitHub [Blog post]. Retrieved from https://kinsta.com/knowledgebase/what-is-github/
- This enables software developers to keep track of what has been done and return to a previous phase. Help team members stay up-to-date on what is completed. Git stores each version like a snapshot of changes of made to each file. Side note, Git may not be able to read other changes made in real time in local software installments. However, you can assign tasks to other team members, etc. Pretty much overall, best for individual-use.
What is Github? GitHub is a for-profit company that offers a cloud-based Git repository hosting service. Basically, Github enables you to share projects on your profile and keeps a timeline of all the ones you’ve contributed to as well.
- Essentially, it makes it a lot easier for individuals and teams to use Git for version control and collaboration. That being said, GitHub’s interface is user-friendly enough so even novice coders can take advantage of Git. Without GitHub, using Git generally requires a bit more technical savvy and use of the command line.
Kinsta, inc. (2016, September 16). What is Github? A Beginner’s Introduction to GitHub [Blog post]. Retrieved from https://kinsta.com/knowledgebase/what-is-github/
Objectives:
- Fork the Level Up In Tech Repo Here: https://github.com/LevelUpInTech/LevelUpTeam
- Clone the forked repo to your ACG cloud server environment
- Using Vim, create a change to the linux.sh file that is in the repo directory
- Save the file and add to your local repo, then commit the file
- Push the file back to your own github repo
- Send a pull request to merge with Level Up In Tech production repo
install git on Debian based
Forking — the process of copying another’s code and modifying it in another repository.
- Select dropdown “Create a new fork” at the correct repository, you will be asked a few questions pertaining to the new fork you are creating. Renaming Owner and New Repository Name.
Cloning — We should make a new directory to insert the cloned repository. I made a directory called “clone.”
2. git clone <enter HTTP link of cloned repository>
Get Sheena Lynn Narciza’s stories in your inbox
Join Medium for free to get updates from this writer.
3. change directories to LevelUpTeam Directory then check list
cd LevelUpTeam/
ls- Using Vim, create a change to the linux.sh file that is in the repo directory. Then making changes to thelinux.sh file in theLevelUpTeam usingVim. Using “Vim” command.
- The script is now changed. Save and exit using :wq!
Git add linux.sh
git status
git commit -a -m "added info" command with quotations to let the team know I made changes to the file.Note: You may be prompted to identify who you are. This is for logging purposes to know who made changes etc.
Pushing — Now we push our file back to our GitHub repo. Before that, you will need a personal access token. For this, do the following:
git init
git config user.name "Your_name"
git config user.email "example@example.com"You may encounter an error!
If you get an error that states “your branch is ahead of ‘origin/main’ by x commit..
Solution:
- Generate an SSH key and add it to the key agent, for more information click here
- Then add that key to GitHub under settings → SSH and GPG keys
- Add a new SSH key
- Then switching the url to your repository from HTTPS to SSH in the terminal, for more information click here
Once that is all done, you should be able to push the files back to your own GitHub repo, the output will look like:
- Go to your GitHub profile and click on settings
- Click on Developer Settings
- Click Personal Access Tokens and select Generate new token
- Choose which permissions you want to have
- Click on Generate token
- Copy your Personal Access Token to your clipboard
Now that you have your personal access token, lets push the file back to GitHub. Use the following command along with your GitHub access token:
Pulling — when you finished making changes to someone else’s code you can share them with the original owner via a pull request.
Merge — owners can new changes to their projects and give credit to comtributers who suggested them.









