How to push a code change into GitHub remote repository

Let us see how to push a code change using Git bash or iTerm on your local machine into GitHub.

After configuring a freestyle job or pipeline using Jenkins for building and deployment, you would like to make a code change to make sure Jenkins have started automated builds/deployments.

Pre-requistes:
SSH keys set up and uploaded into GitHub.

Implementation steps:
1. Go to GitHub, select repository which you already have setup MyWebApp.
If you already cloned, move to step # 6.
2. Click on clone
3. copy SSH clone url
4. go to git bash window
5. paste the url and enter



git clone git@github.com:user_name/myFebBatchRepo.git
type yes to connect. now perform to list the repo, perform below command:

ls -al


you should see the repo name. once you see the repo name, copy the repo name and

6. cd myFebBatchRepo

change repo_name per your name of the repo you created in GitHub.

7. cd MyWebApp/src/main/webapp
8. sudo vi index.jsp


Change Hello world into below yellow highlighted:
<html>
<body>
<h2>Howdy Folks !!! Welcome to DevOps!</h2>
</body>
</html>

9. press escape, enter :wq!
10. git add index.jsp
11. git commit -m "made change to jsp"
12. git push

Now refresh the browser and click on Source to see code changes you made in your git bash window.

Post a Comment

0 Comments