# Contributing to Open-Source DevOps Projects with Git & GitHub

### <mark>Git and GitHub</mark>

Open source----Source means source code.

Open source---&gt;GitHub---&gt;Create GitHub account---&gt;Explore--&gt;you can pick a project and find the issues on project.

<mark>Git</mark>\-Git is a tool that is version control system. A lot of people If you are working on your project in your file then everything will be Messed up right. Git version control system provides versioning. So you can go back to any version or rolled back.

<mark>GitHub</mark>\-GitHub is a open source platform where you can contribute to it, Make the repository and projects.

When you create a repository on GitHub, clone it to local git and copy it.

Git repository which is on GitHub, you can access it locally that process is called clone.

### `First create a new EC2 instance.`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713025760389/53e38e38-8eda-4cdc-a4f6-47b9e35543cf.png align="center")

New instance created.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713025960557/7dab1a54-72e4-4fff-bfed-797217dda7a8.png align="center")

Wanderlust project URL

[https://github.com/krishnaacharyaa/wanderlust/](https://github.com/krishnaacharyaa/wanderlust/)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713026271983/819778ec-a905-4453-b5a6-33acc63da4d9.png align="center")

I already login in my GitHub account and forked the repository Wanderlust project.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713026109218/c5b7f9ce-21de-4e0e-b34b-0ace479acd71.png align="center")

<mark>Commands:-</mark>

mkdir git-demo

ls

cd git-demo

git clone [https://github.com/krishnaacharyaa/wanderlust.git](https://github.com/krishnaacharyaa/wanderlust.git)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713026665363/4f08ebd4-c406-499d-94bb-ff59a08d2ddd.png align="center")

cd

### <mark>We have set username and email</mark>

git config --global [user.name](http://user.name) "[siddharth249859](https://github.com/siddharth249859)"

[git config --g](https://github.com/siddharth249859)lobal [user.email](http://user.email) "[siddharthgupt444@gmail.com](mailto:siddharthgupt444@gmail.com)"

cd git-demo/

ls

### **<mark>wanderlust</mark>**

cd wanderlust/

git remote -v

I clone the repo krishnacharya

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713027684472/5c4c8ec0-a5fe-47a3-91c4-3d93ec5fb086.png align="center")

cd ..

cd ..

mkdir my-repo

ls

### **Now i clone my own fork repo**.

git clone [https://github.com/siddharth249859/wanderlust.git](https://github.com/siddharth249859/wanderlust.git)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713028095610/264b3bc5-f1aa-4f08-a032-25703c367ded.png align="center")

ls

vim README.md

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713028301457/dbb21d5e-0326-4892-b713-13b56195ab5e.png align="center")

I need to change the [readme.md](http://readme.md) file, what to change? Install required dependencies before this I want to install NPM so some commands are required I need to include these commands in the readme file as well. You have made some changes to the repository and contributed something.

Now save :wq

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713028808517/d01620eb-7c87-4ba0-adc3-d71595bfe03e.png align="center")

git status

You have a modified the README.md file.

Add the file

git add README.md

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713029205943/1d923f02-b536-487a-8d88-92066b8867c5.png align="center")

Whenever you make a change, you change the file system then you want to put it in a Git, it is Git VCS. There is something in the file system that you want to put into Git there is some commands to perform it.

VCS-Version control system

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713029296444/55bcf43e-fbca-4331-96e6-13f0300b6bc2.png align="center")

git status----Your file has been modified but the file still in staged state so you can commit it then your file is tracked in Git VCS.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713029537601/6e98bf11-3d36-4c97-ae57-a6b8d5af5bd0.png align="center")

When you use the commit command first checked in contributing.md file and click on it.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713030173711/baf8b457-b18b-4e01-a283-29b2bb1c6df5.png align="center")

**Commit Format**: When making commits, follow this format: `tag-#issue-number: <commit-message>`. The tag should be one of these: `fix`, `feat`, `docs`, `chore`, `refactor`.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713030368899/a7cc605f-cfbd-4b0c-89ab-b88f8406f9da.png align="center")

git status--Current you are in main branch

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713030724331/e3877838-adbe-457a-8e1d-f3bce5f05de4.png align="center")

Right now this repository of yours, in which this main branch is running, do not disturb your main branch and you have to create a separate copy for yourself in which you can make changes, create a new branch from there, we In this, a new branch will emerge whose name will be <mark>DevOps</mark>, we will not do things in the main branch, we will do things in the <mark>DevOps branch</mark>.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713030862496/4b5f8bd5-b06f-49ce-9aec-b72d7dcd2923.png align="center")

git checkout -b devops

git status

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713031030925/7a213ff9-4102-4d22-9f0e-99eeb2b8184a.png align="center")

git commit -m "docs -#No issues updated readme with node installation"

Your file moved from Staged area to version control system (Git)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713031480704/75d59d3b-fba8-4ac4-a433-28a815a4ec7c.png align="center")

I have to push the changes in the file from local to my repository.

git push origin devops

Git is this tool, push means changes from local to upload on remote and upload on origin.

git remote -v=Means Origin is the URL of your git repository.

Asking username and password, so never enter the password like this, you will get a create personal access token.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713031930215/dbededb6-ec78-4ec1-ad5f-6d1e81d03af1.png align="center")

Click on settings

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713031984760/25c6c6fb-673e-4dcf-ac5b-8ad45d8b1723.png align="center")

Click on developer settings

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713032041434/7d5fb6a0-7927-4b67-84a9-f563fcc86ce4.png align="center")

Click on personal access token and go to classic token (Classic)

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713032100657/c91c853b-8958-44d8-b4ec-491d7b2f3d69.png align="center")

Click on Generate the new token

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713032181522/b723641d-9bef-41a5-96bc-09273ea97836.png align="center")

Enter the password for authentication then enter the details.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713032397833/26292ea7-1e71-455b-821f-5ff95530933e.png align="center")

Note-Wanderlust-code

Expiration-30 days

Select scopes-repo(isko repository ko access dediya)

Click on generate token

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713032530956/9470d0a3-e95a-4a25-97bb-b6a7d9f2b1f9.png align="center")

Click on generate token.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713032557975/a3a3037e-cdd0-440a-825e-8334be116b28.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713032633608/12de7465-04c7-4b47-b06a-0906d8d8f959.png align="center")

git remote -v

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713032708631/8f28a540-4391-4711-bd18-83613009e2b5.png align="center")

I don't have access to this URL "github.com/siddharth249859/wanderlust.git", I am going to grant access to it, but I am going to issue access with the token.

git remote set-url origin https://ghp\_jYwkJHZOE1ScuYmZr4jEGcIpz91Wmr0KPItw@github.com/siddharth249859/wanderlust.git

git push origin devops

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713033090364/bcfe2b82-da23-44cc-a9ea-681cbcc78053.png align="center")

**Just go your repository new branch devops is created and check your changes is reflect**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713033172830/be4ee0bc-20a3-4503-a459-cce5e1468a07.png align="center")

Click on devops branch

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713033243880/29824655-cd56-41ad-86b7-ecdcd9500047.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713033292726/350f68c0-7d46-4b65-814e-2d22314c094d.png align="center")

If you want to add changes to the DevOps branch, you can make a pull and pull request.

Pull Request: Merge the changes in your branch into the main branch.

When you merge a pull request, changes from one of your branches move to the other branch.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713033501157/ed0ffaed-5ce6-4c7f-b898-2bc5403f7ae2.png align="center")

### <mark>This is demo PR. Please don’t create such PRs. Any PR without issue Number will be rejected it Open-source.</mark>

Readme file cannot be changed, just for understanding. The one who can solve the real issues of the project will also be left by the owner of repository. In Wanderlust project the owner did not ask to change the readme file so this readme change request will never be accepted. Issue no also not mentioned.

This is known as open source contribution.

<mark>Click on pull request</mark>

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713034046192/2e02d9be-9fa9-4cf3-9f46-a43adc47fb5b.png align="center")

<mark>Pull request created</mark>

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713034272461/3eb7293c-ad28-4711-b899-28283c84a240.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1713034522663/bf589466-a005-4932-aa1d-5786a48398a6.png align="center")

<mark>Always remember one thing don’t changes directly in github repository. First you clone your project in local and create a new branch then after changing anything in new branch.</mark>

*Happy Learning :)*

Thank you for reading this Blog. Hope you learned something new today! If you found this blog helpful, please like, share, and follow me for more blog posts like this in the future😊😊.
