How to Connect Jenkins with GitHub
Part 2
In Jenkins, you can create automation workflows (pipelines) using Freestyle projects or Pipeline projects. Let’s see the differences:
Freestyle Project
Simple and easy to create
No coding required
Suitable for small, simple jobs
Limitations:
Hard to manage for complex or large workflows
Not ideal for real-time, production-grade CI/CD pipelines
Pipeline Project
Most commonly used in real-world projects
Written as code (Jenkinsfile) → easy to version control
Supports complex workflows, stages, and parallel tasks
Easier to maintain, extend, and manage
The best way to learn easy start with freestyle and step into pipeline

Let’s create a Freestyle project and get a code from github to jenkins
Open Jenkins URL in your browser
http://<public-ip-address>:8080
Click “New Item” on the left menu.
Enter a name for your project (e.g.,
MyFirstFreestyle).Select Freestyle project and click OK.

Configure your project by selecting the source code management and specifying the branch name correctly. If the repository is private, provide the necessary credentials as well.


Providing Credentials in Jenkins for a Private GitHub Repo
Creating Token in Github
Go to GitHub → Settings → Developer Settings → Personal Access Tokens → Tokens (classic)
Click Generate new token → give a name/description
Select Scopes:
repo(full control of private repositories)workflow(optional if using GitHub Actions)
Click Generate token → copy the token (you won’t see it again)
Note: This token will act as your password.
Add Credentials in Jenkins
Open Jenkins → Manage Jenkins → Credentials → System → Global credentials (unrestricted)
Click Add Credentials
Choose:
Kind:
Username with passwordUsername: your GitHub username
Password: the personal access token you just generated
ID: optional, e.g.,
github-privateDescription: e.g.,
GitHub Private Repo Token
Click OK

Common Issues You May Encounter
Git not installed – Make sure Git is installed on your Jenkins server.
Port blocked – Check that the security group allows the required port (usually 8080).
Credentials not selected – After creating credentials for a private repo, make sure you select them in your job configuration.
Wrong branch name – Many repos use
maininstead ofmaster. Check the branch specifier in your job.Empty repository – If your GitHub repo has no commits, Jenkins cannot build anything.
Conclusion
Connecting Jenkins with GitHub is an important step for automating your development workflow. Freestyle projects are good for beginners and simple tasks, while Pipeline projects are better for complex workflows. For private repositories, setting up credentials ensures secure access. By following these steps, you can create CI/CD pipelines, avoid common issues, and make your development process faster, smoother, and more reliable.
If you found this guide useful, please like ❤️, comment, and share your thoughts or questions. Stay tuned for the next part, where we'll explore advanced Docker concepts and practices.
Thank you,
Yours, Rama Grandhi