Trending Tutorials

Jenkins Beginner Tutorial 8 – Jenkins integration with GIT (SCM)

Jenkins Beginner Tutorial 8 – Jenkins integration with GIT (SCM)

Today we will learn
1. Create a java program and run it through command line
2. Create a Jenkins job to run the java program
3. Add this program/project to Git
4. Jenkins – add git plugin
5. Configure Jenkins job to trigger the execution when a change is pushed to GitHub

Step 1 :…

45 Comments on Jenkins Beginner Tutorial 8 – Jenkins integration with GIT (SCM)

  1. Raghav garu….when I create a new job in Jenkins, after saving to run a build a job then after it is field every time.not only one build all builds are field wt is the resion sir

  2. @Raghav , I have tried the same way but when trying to connect Jenkins to GitHub SCM getting error as "Failed to connect to repository : Error performing command: git.exe ls-remote -h HEAD" . Any idea where I can check for this error

  3. How did the Maven Project come there? Did you add any plugin in Jenkins for that?

  4. Awsome and simple explanation….Great work…Keep it up

  5. Hello, Thank you for your tutorial, but am having this error below in jenkins when i click build now, but the java compile successfully in the terminal please help,Thanks
    Console Output
    Building in workspace /Users/Shared/Jenkins/Home/workspace/hello
    [hello] $ /bin/sh -xe /Users/Shared/Jenkins/tmp/
    + cd /Users/udo/Sites/javaproject2
    + javac error: error while writing Hello: Hello.class (Permission denied)
    public class Hello{
    1 error
    Build step 'Execute shell' marked build as failure
    Finished: FAILURE

  6. hai raghav,very good explanation..i m facing one issue when i installed jenkins i m not having any plugins in my dashboard ..its not seen in available neither in installed …any suggestion

  7. thanks man, i was following ur videos and i was able to understand jenkins and configure it with protractor you rock man <3

  8. Hi Raghav, this is Rajesh i have been following your tutorial.
    now am in 8th tutorial in jenkins. i have an error while having hands on this particular tutorials that:
    Am using AWS free account – am using redhat 7.4 instance and i have created java program and complied
    and run it in instance
    but when i do the same in jenkins(when i build the job) am getting an error in console output saying that

    "Started by user Rajesh Devarakonda

    Building in workspace /var/lib/jenkins/workspace/HelloWorld

    [HelloWorld] $ /bin/sh -xe /tmp/

    + cd /home/ec2-user/JavaProgram

    /tmp/ line 2: cd: /home/ec2-user/JavaProgram: Not a directory

    Build step 'Execute shell' marked build as failure

    Finished: FAILURE"

    Can Please solve the issue

  9. good job, very simple tutorial

  10. Very useful video

  11. I have seen many tutorials.. but this one is really clear and awesome.. Explained every small step..

    Thanks a lot, Raghav!

  12. Hi

    i need some help for jenkins..

    am making new build in ITCDM and selecting environment as well. my deployment is integrated with jenkins as well. So while deploy code in itcdm , it will trigger build in jenkins and then itcdm deploy the code in respective environment.

    i want to take deployed environment for my other downstream jenkins job?

    Developer ->Code Deploy -> Jenkins Job (A)-> Build the code -> send back to ITCDM – but i want to take value of env from jenkins job and need to pass that value to another jenkins Job (B)

    my email:

  13. really awesome explanation, good going brother

  14. hi, Im not able to find the git plugin in github?Please help me?

  15. Hey Raghav! So when I give shell commands same like how you did, the build fails, I get permission denied error. And it's on Amazon ec2 server. Do I have to create a user? It's running as jenkins admin user

  16. By far the best tutorials I've seen in YouTube ,thank you.
    keep up the good work.

  17. Raghav one question what is the general practice for managing the projects in Git
    example – if I have 4 Java projects so I should create 4 repos for each or 1 repo to group them and keep the projects inside the repo, in that case how can I locate my projects from Jenkins for compilation?

  18. I would like to do more but the only thing i can tell you is thanks you 🙂

  19. Hi , Thank you for this session.
    Can we add git command like "git diff HEAD~2 HEAD" in jenkins job ?

  20. Note : In Step 5 : Configure Jenkins job to trigger the execution when a change is pushed to GitHub if you get an error
    * Failed to connect to repository Error performing command ls remote git exe -h <repo URL>

    Go to Global Tool Configuration. and check if you find an error as below.

    There's no such executable git.exe in PATH:

    So please specify the right git.exe location as per the location in your system

    ex : C:Program FilesGitbin

  21. Can we just ignore the webhook part that I've seen in other tutorials? BTW, thanks! This was helpful.

  22. FATAL: org/jenkinsci/plugins/workflow/job/WorkflowRun
    java.lang.NoClassDefFoundError: org/jenkinsci/plugins/workflow/job/WorkflowRun
    at org.jenkinsci.plugins.workflow.job.WorkflowJob$SCMListenerImpl.onCheckout(
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(
    at jenkins.scm.SCMCheckoutStrategy.checkout(
    at hudson.model.AbstractBuild$
    at hudson.model.Run.execute(
    at hudson.model.ResourceController.execute(
    Finished: FAILURE

    why i am getting this error . i have this problem since 3 days.please look into this.

  23. Hi Raghav
    please look into my problem as well. I have my directory also from cmd prompt to run eclipse .java class . It is only compiling but not able to execute.
    video link which you have shared to run java program with cmd that i know. but this JAVA CLASS from eclipse is not working

  24. Thanks for such tutorial. I have few doubts.
    1. Can we trigger build after staged commit?If yes, how to do it?
    2. It does git pull by itself or we have do some config changes

  25. Hi Raghav… very nice videos and well explained
    I have a one doubt, while creating the job for java program, you have specified the path but I tried it's not worked out..
    Its showing me .. Not a directory.. could you help me on that.
    I resolved it by placing the java file into the workspace and it works fine.

  26. I saw also your playlist Git ,I found it very helpful and give me more informations Thanks ,

  27. Excellent I am very happy ,Is my first Time I work with Jenkins and I anderstand all the manipulation , you'r a teacher a good one
    Great job Sir

  28. hi Raghav,
    I can see 'timeout' warnings in your output at 15:44
    even I'm facing the same issue. Is it normal?

  29. Hi Raghav, thx for all these videos and when I went to add git address step that got some error :Failed to connect to repository : Error performing command: git ls-remote -h HEAD . need set up git plugin?

  30. Nice video. I learned a lot. I have one question how to access private repository e.g how to configure username and password of github repos for accessing

  31. very well explained….!!!

  32. Thanks a Tonnnnn buddy.. u explained in a very simple and efficient way !! Helped me greatly !!

  33. Hi Raghav, very nice tutorial for beginners
    Thanks for it.

    i am getting below error while configuring the job in jenkins
    Console Output
    Started by user admin
    Building on master in workspace C:JenkinsJenkinsHomeworkspaceHelloWorld
    Cloning the remote Git repository
    Cloning repository
    > git.exe init C:JenkinsJenkinsHomeworkspaceHelloWorld # timeout=10
    ERROR: Error cloning remote repo 'origin'

    Caused by: Cannot run program "git.exe" (in directory "C:JenkinsJenkinsHomeworkspaceHelloWorld"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(
    at hudson.Proc$LocalProc.<init>(
    at hudson.Launcher$LocalLauncher.launch(
    at hudson.Launcher$ProcStarter.start(
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(
    … 16 more
    Caused by: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    … 22 more
    ERROR: Error cloning remote repo 'origin'
    Finished: FAILURE

    Please help

  34. Hi am a bit confused with running the scripts on terminal, this is a brief layout of my project src – main/test – java – TestSuites – (all of my class) /Users/name/Test-Automation-suite/automationtestsuite/src/test/java/TestSuites  when I do java article, I get Not a directory. Can you help with this please

  35. I am so grateful, god bless you .

  36. Great job, very helpful 🙂

  37. Hi Raghav,
    Thanks a lot for your explanation .
    I am not from programming background . Is it necessary to have good programming knowledge to get into DEVOPS world ?
    Please Suggest.

  38. I am getting GIT_ASKPASS Error with GIT PLUGIN please help

    Error Stack:
    F:InstallationsGit- –version # timeout=10
    using GIT_ASKPASS to set credentials
    > F:InstallationsGit- fetch –tags –progress origin
    ERROR: Error fetching remote repo 'origin'
    hudson.plugins.git.GitException: Failed to fetch from
    at hudson.plugins.git.GitSCM.fetchFrom(
    at hudson.plugins.git.GitSCM.retrieveChanges(
    I am stuck and not able to build

  39. I was struggling around from a long time, I found other Channels tut very complicated….You explained it very smoothly like a butter…..Great Job …Thanks a lot.

  40. wonderfull vedio… but i am having 1 doubt here you created a project and pushed it to git..suppose if i am have downloaded the project from gitlab so just we need to give url right?? if some changes happens in that project from developer side so it will trigger automatically in jenkins ryt??

  41. one quick question : why we need step 2 ? say here i am already having my code in git , and that is triggered through the new job which i set from jenkins (after installing git plugin). then why you did step 2 ? i mean executing same program from console or using freestyle project

  42. getting this error. Failed to connect to repository : Error Performing command: Is-remote-h.

  43. Great tutorial. very recommended

  44. Good day Raghav,
    Our group is monitoring software builds that are built independently and not added to git or github. They get placed in a network file directory on our local network. Is there a way to monitor a local file in a directory so if a new file gets dropped into it we know a new software build was just added?

  45. Hi Raghav , is there a video by you on different ways to schedule jenkins jobs ? Here you used 5 star concept .. what other standards do we have ?

Leave a comment

Your email address will not be published.