Fork,Clone,Push Using Git and Github.

Nipulpatel
4 min readJan 9, 2024

I will be using Git and Github to fork,clone, and push a repository. Git is a high-quality version control system that helps you track and manage source code changes. Github is a cloud service that lets you manage Git resources and repositories.

  1. Fork The Repo Here:
  2. https://github.com/atapas/fork-me
  3. Clone the forked repo to your ACG cloud server environment
  4. Using Nano, create new boon.txt file that is in the repo directory
  5. Save the file and add to your local repo, then commit the file
  6. Push the file back to your own github repo

Objective 1

To complete the first objective, we have to fork the repository https://github.com/atapas/fork-me.git.Forking a repository means copying a repository to your own GitHub. This allows you to work on and make changes to a repository without affecting the original copy.

Clicking on the link https://github.com/atapas/fork-me.git will take you to the Github repository. Click on the “Fork” feature.

objective 2

clone the repository that was forked from your github repo to your local device. We do so by typing the command. Make sure the repository you are copying is public.If private, ask the owner to grant permission or credentials.

git clone https://github.com/nipul07/fork-me.git

The repository has been cloned to your local device. The second objective has been completed.

Objective 3

The third objective is to make a new file boon.txt using nano editer in the repository on the local device. add some line to the file save and exit .

cd into the directory fork-me

objective 4

The fourth objective is to save the change, add it to the local repo, and commit the change . We must add our changes . To add our changes to the repo, we use the command

git add boon.txt

The changes have been added to the repo, we will now commit the changes with a message

git commit -m “make final changes”

The fourth objective has been completed.

Objective 5

The fifth objective is to push the file back to our own GitHub repo. The command for pushing is “git push” with the URL to the github repo. You will be asked for your username and then your password. This is where it gets tricky: if you use your GitHub password, it will not work. You have to create a PAT (Personal Access Token). This token will be used instead of your password. To create a PAT, we go to:

After going to settings, click on Developer Settings, which is located at the bottom of the settings.

After clicking on Developer settings, click on Personal Access Token.

Click on “token (classic)” and click on “generate new token.”

Select “General new token(classic)”

Verify password to account

Set up the notes , expiration, and scope for which the token will be used. Be sure to click on all the scopes that you will be using.

click on “generate token” at the bottom and the token will be created

Copy and save the token securely, because when you leave the page you won’t see it again.

Copy the token and return to your local device terminal. Use the command

git push -u origin main

When prompted for a username and password, use your GitHub username and use the PAT that was generated. “origin main” means where the local repo originated from, or you can use the URL of the repo instead.

This will push the file back to your GitHub repo and all the changes that have been made on the file in github

You can see my commit which says “make final changes”

here I used git and github to clone, fork, push . I installed and configured git on my local device, cloned a Github repository to my local device, made changes to the repository, and pushed the repository back to gitHub with the changes I made.

--

--

No responses yet