Jenkins : Issue fetching private repositories GitHub

I will explain you what I have done till now.

 

  1. Installed java 8 and Jenkins (tried with Tomcat and also through command line (java -jar jenkinswarfile)).And Git application.
  2. Installed GitHub plugin
  3. Created a freestyle job with a public repository along with the jenkins credentials for github.It is building.
  4. Created a similar job for private repository and the github fetching is failing.
  5. I am able to clone same repo from git application but not through jenkins.