Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jenkins git plugin cloning every time

I created one job for polling the Git Source code.

First time it should clone the repository, and after that if repository exist then it should only pull it.

See the following setting for job.

enter image description here

Problem: every time when i run this job it always clone's it rather then polling it.

I'm Checking on Fast remote polling, It says that repository should have only one branch. So for that i'm specifying the branch name.

What i'm missing here..?

like image 218
Sumit Singh Avatar asked Dec 09 '13 07:12

Sumit Singh


People also ask

Can you clone a repository multiple times?

Simply clone your project's repo twice (or even more often). When your work on a feature branch is done, simply push that branch and check it out on your 2nd copy to run tests there.

Is it possible to clone a Git repository in Jenkins?

There are two ways to clone the project(repository) from Github. Create a new Jenkins job called 'Clone-with-https', move to the “Source Control Management” setting, and choose “Git” options if you cannot see the Git options that mean the 'GitHub' plugin wasn't installed in the Jenkins machine.


2 Answers

Make sure in slave git has latest version: See below for more details:

enter image description here

like image 109
Sumit Singh Avatar answered Sep 28 '22 07:09

Sumit Singh


There was a similar bug for Mercurial which pointed out to a credential issue.
So double-check the way your credentials are passed (either through the url or stored in a file, like a .netrc for hhtps)

The point is: fast polling should fetch/pull, not clone. See hudson.plugins.git.GitSCM#compareRemoteRevisionWithImpl().

            if (git.hasGitRepo()) {
                // Repo is there - do a fetch
                listener.getLogger().println("Fetching changes from the remote Git repositories");

                // Fetch updates
                for (RemoteConfig remoteRepository : paramRepos) {
                    fetchFrom(git, listener, remoteRepository);
                }

                listener.getLogger().println("Polling for changes in");
like image 31
VonC Avatar answered Sep 28 '22 07:09

VonC