9 min readOct 15, 2025
–
Introduction
This comprehensive guide will walk you through setting up a complete CI/CD pipeline on Windows, from creating your first GitHub repository to automating builds with Jenkins. By the end of this tutorial, you’ll have a fully functional setup where pushing code to GitHub automatically triggers builds in Jenkins.
Part 1: Installing Git on Windows
Step 1: Download Git
- Visit the official Git website: https://git-scm.com/download/win
 - The download should start automatically. If not, click on the appropriate version (64-bit or 32-bit)
 - Save the installer file to your computer
 
Step 2: Install Git
- Run the downloaded 
.exefile - Click Next through the license agreement
 - Choose the i…
 
9 min readOct 15, 2025
–
Introduction
This comprehensive guide will walk you through setting up a complete CI/CD pipeline on Windows, from creating your first GitHub repository to automating builds with Jenkins. By the end of this tutorial, you’ll have a fully functional setup where pushing code to GitHub automatically triggers builds in Jenkins.
Part 1: Installing Git on Windows
Step 1: Download Git
- Visit the official Git website: https://git-scm.com/download/win
 - The download should start automatically. If not, click on the appropriate version (64-bit or 32-bit)
 - Save the installer file to your computer
 
Step 2: Install Git
- Run the downloaded 
.exefile - Click Next through the license agreement
 - Choose the installation location (default is usually fine: 
C:\Program Files\Git) - Select components — keep the defaults selected:
 
- Windows Explorer integration
 - Git Bash Here
 - Git GUI Here
 
- Choose the default editor (select your preferred editor or leave as Vim)
 - Adjust your PATH environment — select “Git from the command line and also from 3rd-party software”
 - Choose HTTPS transport backend — select “Use the OpenSSL library”
 - Configure line ending conversions — select “Checkout Windows-style, commit Unix-style line endings”
 - Configure terminal emulator — select “Use MinTTY”
 - Choose default behavior of 
git pull- select “Default (fast-forward or merge)” - Choose credential helper — select “Git Credential Manager”
 - Enable file system caching — check this option
 - Click Install
 
Step 3: Verify Installation
Open Command Prompt or PowerShell and type:
git --version
You should see output like: git version 2.x.x.windows.x
Step 4: Configure Git
Set up your identity (this will be associated with your commits):
git config --global user.name "Your Name"git config --global user.email "your.email@example.com"
Verify your configuration:
git config --list
Part 2: Creating a GitHub Account
Step 1: Sign Up
- Go to https://github.com
 - Click on Sign Up in the top right corner
 - Enter your email address and click Continue
 - Create a strong password and click Continue
 - Enter a username (this will be your GitHub handle) and click Continue
 - Choose whether you want to receive updates and click Continue
 - Solve the verification puzzle
 - Check your email for the verification code
 - Enter the 6-digit code sent to your email
 
Step 2: Personalize Your Account
- Answer the questions about your experience (or skip)
 - Choose the free plan
 - Complete your profile by adding a profile picture and bio (optional)
 
Part 3: Creating Your First Repository
Step 1: Create a New Repository
- Log in to your GitHub account
 - Click the + icon in the top right corner
 - Select New repository
 - Fill in the repository details:
 
- Repository name: 
my-jenkins-project - Description: “Testing GitHub and Jenkins integration”
 - Visibility: Select Public (this is important for Jenkins integration without authentication)
 - DO NOT initialize with README, .gitignore, or license (we’ll add files later)
 
- Click Create repository
 
Step 2: Note Your Repository URL
After creation, you’ll see a page with setup instructions. Copy the repository URL, which looks like:
https://github.com/YOUR-USERNAME/my-jenkins-project.git
Part 4: Creating a Branch
Step 1: Clone the Repository Locally
Open Command Prompt or PowerShell and navigate to where you want to store your project:
cd C:\Users\YourUsername\Documentsgit clone https://github.com/YOUR-USERNAME/my-jenkins-project.gitcd my-jenkins-project
Step 2: Create a New Branch
git branch development
Step 3: Switch to the New Branch
git checkout development
Or create and switch in one command:
git checkout -b development
Step 4: Verify Your Current Branch
git branch
The active branch will be marked with an asterisk (*).
Step 5: Push the Branch to GitHub
git push -u origin development
This creates the branch on GitHub and sets up tracking.
Part 5: Creating a Shell Script (.sh File)
Step 1: Create the Script File
In your project directory, create a new file called build.sh:
echo "" > build.sh
Step 2: Edit the Script
Open build.sh with any text editor (Notepad, VS Code, etc.) and add the following content:
#!/bin/bash
echo "=================================="echo "Starting Build Process"echo "=================================="echo "Build Date: $(date)"echo "Build Number: ${BUILD_NUMBER:-Manual}"echo "=================================="echo "Hello from the build script!"echo "This is version 1.0"echo "=================================="echo "Build completed successfully!"echo "=================================="
Note: Even though Windows uses PowerShell/CMD, the .sh file will be executed by Jenkins, which can run bash scripts.
Step 3: Save the File
Save and close the editor.
Part 6: Git Operations — Add, Commit, and Push
Step 1: Check Status
See what files have changed:
git status
You should see build.sh as an untracked file.
Step 2: Add Files to Staging
Add the specific file:
git add build.sh
Or add all changes:
git add .
Step 3: Commit Changes
git commit -m "Add initial build script"
The -m flag adds a commit message describing your changes.
Step 4: Push to GitHub
Push your changes to the remote repository:
git push origin development
This pushes the development branch to GitHub.
Step 5: Verify on GitHub
Go to your GitHub repository in a browser and switch to the development branch using the branch dropdown. You should see your build.sh file.
Part 7: Git Pull Operations
Pulling Changes from Remote
When others make changes or you make changes from another location, you’ll need to pull updates:
git pull origin development
This fetches and merges changes from the remote development branch.
Best Practice Workflow
Before making changes, always pull first:
git pull origin development# Make your changesgit add .git commit -m "Your commit message"git push origin development
Part 8: Installing and Setting Up Jenkins on Windows
Step 1: Download Jenkins
- Visit https://www.jenkins.io/download/
 - Download the Windows installer (
.msifile) - Alternatively, download the Generic Java package (.war) if you prefer
 
Step 2: Install Jenkins
Using the Windows Installer:
- Run the downloaded 
.msifile - Follow the installation wizard
 - Jenkins will install as a Windows service
 - Default port is 
8080 
Using the WAR file:
- Ensure Java is installed (download from https://www.oracle.com/java/technologies/downloads/))
 - Open Command Prompt
 - Navigate to where you saved 
jenkins.war - Run:
 
java -jar jenkins.war
Step 3: Access Jenkins
- Open a web browser
 - Go to 
[http://localhost:8080](http://localhost:8080) - You’ll see the “Unlock Jenkins” page
 
Step 4: Unlock Jenkins
- The installer will show you a path to the initial admin password, typically:(
C:\Program Files\Jenkins\secrets\initialAdminPassword) - Open this file with Notepad
 - Copy the password and paste it into the web interface
 - Click Continue
 
Step 5: Install Plugins
- Choose Install suggested plugins
 - Wait for the installation to complete (this may take several minutes)
 
Step 6: Create First Admin User
- Fill in the form with your details:
 
- Username
 - Password
 - Full name
 - Email address
 
Click Save and Continue
Step 7: Configure Instance
- Keep the default Jenkins URL (
http://localhost:8080) - Click Save and Finish
 - Click Start using Jenkins
 
Part 9: Installing Required Jenkins Plugins
Step 1: Access Plugin Manager
- From the Jenkins dashboard, click Manage Jenkins
 - Click Manage Plugins
 - Click the Available plugins tab
 
Step 2: Install Git Plugin
- In the search box, type Git Plugin
 - Check the box next to Git Plugin (it might already be installed)
 - Also search for and install:
 
- GitHub Plugin
 - Git Client Plugin
 
Step 3: Install Plugins
- Click Install without restart (or Download now and install after restart)
 - Wait for installation to complete
 
Part 10: Configuring Git in Jenkins
Step 1: Configure Git Path
- Go to Manage Jenkins → Global Tool Configuration
 - Scroll down to Git section
 - Click Add Git
 - Name: 
Default - Path to Git executable: 
C:\Program Files\Git\bin\git.exe - Click Save
 
Part 11: Linking GitHub and Jenkins
Since your repository is public, you don’t need to set up credentials. Jenkins can access public repositories directly.
Verification
- Make sure your repository is set to Public on GitHub:
 
- Go to your repository
 - Click Settings
 - Scroll to the bottom
 - Under Danger Zone, verify visibility is “Public”
 
Part 12: Creating a Freestyle Job in Jenkins
Step 1: Create New Job
- From Jenkins dashboard, click New Item
 - Enter job name: 
GitHub-Build-Job - Select Freestyle project
 - Click OK
 
Step 2: Configure Source Code Management
- In the Source Code Management section, select Git
 - In Repository URL, paste your GitHub repository URL:
 
https://github.com/YOUR-USERNAME/my-jenkins-project.git
Credentials: Leave as **— none **— (since the repo is public)
Branch Specifier: Change from */master to */development
Step 3: Build Triggers
Do NOT check any build triggers since you want to build manually or trigger manually.
Step 4: Configure Build Steps
- Scroll down to Build Steps section
 - Click Add build step
 - Select Execute Windows batch command
 - In the command box, enter:
 
@echo offecho Running build script...type build.shecho.echo ================================echo Executing script contents:echo ================================bash build.sh
Alternative if Git Bash is in PATH:
"C:\Program Files\Git\bin\bash.exe" build.sh
Step 5: Save Configuration
Click Save at the bottom of the page.
Part 13: Testing the Pipeline
Step 1: Initial Build
- On your job page, click Build Now
 - You’ll see a build appear in the Build History
 - Click on the build number (e.g., #1)
 - Click Console Output
 - You should see the output from your 
build.shscript 
Step 2: Make Changes and Push
- Open 
build.shon your local machine - Modify the script (e.g., change the version number):
 
#!/bin/bash
echo "=================================="echo "Starting Build Process"echo "=================================="echo "Build Date: $(date)"echo "Build Number: ${BUILD_NUMBER:-Manual}"echo "=================================="echo "Hello from the build script!"echo "This is version 2.0 - NEW UPDATE!"echo "=================================="echo "Build completed successfully!"echo "=================================="
- Save the file
 - Commit and push:
 
git add build.shgit commit -m "Update build script to version 2.0"git push origin development
Step 3: Trigger New Build in Jenkins
- Go back to Jenkins
 - Click on your job GitHub-Build-Job
 - Click Build Now
 - Click on the new build number
 - Click Console Output
 - You should see the NEW output with “version 2.0 — NEW UPDATE!”
 
Step 4: Verify Changes
Each time you:
- Modify 
build.sh - Commit and push to GitHub
 - Build in Jenkins
 
The console output will reflect your latest changes!
Part 14: Understanding the Console Output
What to Look For
When you check the console output in Jenkins, you’ll see:
- Git operations: Jenkins pulling the latest code from your repository
 - Build execution: Your script running
 - Script output: Everything echoed from your 
build.shfile - Build result: Success or failure status
 
Example Console Output
Started by user adminRunning as SYSTEMBuilding in workspace C:\ProgramData\Jenkins\.jenkins\workspace\GitHub-Build-JobThe recommended git tool is: NONEusing credential noneCloning the remote Git repositoryCloning repository https://github.com/YOUR-USERNAME/my-jenkins-project.git > git init C:\ProgramData\Jenkins\.jenkins\workspace\GitHub-Build-Job > git fetch --tags --force --progress -- https://github.com/YOUR-USERNAME/my-jenkins-project.git +refs/heads/*:refs/remotes/origin/* > git config remote.origin.url https://github.com/YOUR-USERNAME/my-jenkins-project.git > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* > git rev-parse refs/remotes/origin/development^{commit}Checking out Revision abc123... (refs/remotes/origin/development) > git config core.sparsecheckout > git checkout -f abc123...Commit message: "Update build script to version 2.0"[GitHub-Build-Job] $ cmd /c call C:\Users\ADMINI~1\AppData\Local\Temp\jenkins123.bat
C:\ProgramData\Jenkins\.jenkins\workspace\GitHub-Build-Job>@echo offC:\ProgramData\Jenkins\.jenkins\workspace\GitHub-Build-Job>echo Running build script...Running build script...==================================Starting Build Process==================================Build Date: Wed Oct 15 10:30:45 2025Build Number: 2==================================Hello from the build script!This is version 2.0 - NEW UPDATE!==================================Build completed successfully!==================================Finished: SUCCESS
Part 15: Common Workflows and Tips
Making Updates
- Edit locally:
 
cd my-jenkins-project # Edit your files
Check what changed:
git status git diff
Stage and commit:
git add . git commit -m "Descriptive message about changes"
Push to GitHub:
git push origin development
Build in Jenkins: Click “Build Now” and check console output
Switching Between Branches
# View all branchesgit branch -a
# Switch to a different branchgit checkout branch-name# Create and switch to new branchgit checkout -b new-feature-branch
Pulling Latest Changes
# Update your local repositorygit pull origin development
Viewing Commit History
git log# or for a compact viewgit log --oneline
Part 16: Troubleshooting
Git Issues
Problem: Git commands not recognized
- Solution: Ensure Git is added to PATH during installation. Restart Command Prompt after installation.
 
Problem: Permission denied when pushing
- Solution: Check your Git credentials. Run 
git config --listto verify. 
Jenkins Issues
Problem: Cannot access Jenkins at localhost:8080
- Solution: Check if Jenkins service is running. Go to Services (services.msc) and look for Jenkins.
 
Problem: Build fails with “git command not found”
- Solution: Configure Git path in Jenkins: Manage Jenkins → Global Tool Configuration → Git
 
Problem: Script doesn’t execute
- Solution: Verify the bash path in your build step. Use full path: 
"C:\Program Files\Git\bin\bash.exe" 
GitHub Issues
Problem: Cannot push to repository
- Solution: Verify repository URL and that you have permissions. Use 
git remote -vto check configured remotes. 
Conclusion
Congratulations! You’ve successfully:
✅ Installed Git on Windows ✅ Created a GitHub account and repository ✅ Created and managed branches ✅ Created and edited shell scripts ✅ Performed Git operations (add, commit, push, pull) ✅ Installed and configured Jenkins ✅ Linked GitHub with Jenkins ✅ Created a Freestyle job without triggers ✅ Built your project and viewed console output
Every time you push changes to your development branch and manually trigger a build in Jenkins, you’ll see the updated output in the console. This forms the foundation of CI/CD practices!
Next Steps
To enhance your setup, consider:
- Merging to Main: Learn to merge your 
developmentbranch tomain - Webhooks: Set up automatic builds when you push (requires webhook configuration)
 - Pipeline Jobs: Explore Jenkins Pipeline for more complex workflows
 - Notifications: Configure email or Slack notifications for build results
 - Testing: Add automated tests to your build process
 
Happy coding and building! 🚀