Kevin described the proper way.  In the job definition, select "Additional
Behaviours" and the item "Check out to specific local branch" if you need a
local branch in the repository.

I believe the Jenkins git plugin does not use a remote tracking branch by
default because it assumes most continuous integration jobs do not need to
push changes.  If you don't need to push changes, then checkout to a
detached head meets the need without the complexity of managing branches.

Mark Waite

On Tue, Oct 21, 2014 at 12:14 PM, Daniel Serodio <[email protected]> wrote:

> What's the "proper" way to achieve this, instead of manipulating .git/*
> files like Jyotir did? I don't understand why Jenkins doesn't use remote
> tracking branches like most Git integrations do.
>
> Regards,
> Daniel Serodio
>
> On Thursday, February 13, 2014 4:01:20 PM UTC-2, Kevin Fleming wrote:
>>
>> If you commit changes on a detached HEAD (this is a Git term that means
>> you are not on any branch), then nothing can be pushed. Only branches
>> (references) can be pushed to another location.
>>
>> Your build job needs to check out a specific branch, modify it, then push
>> it back.
>>
>> ----- Original Message -----
>> From: [email protected]
>> To: [email protected]
>> At: Feb 13 2014 12:59:05
>>
>> Hi
>>
>> Please help me in this regards.
>>
>> i dont know why after git commit the status revert to old revision and
>> push does not occur.
>>
>> + /usr/bin/git add .
>> + /usr/bin/git status
>> # Not currently on any branch.
>> # Changes to be committed:
>> #   (use "git reset HEAD <file>..." to unstage)
>> #
>> #       new file:   xxxx1.css
>> #       new file:   xxxx2.css
>> #       new file:   xxxx3.css
>>
>>
>>
>> + /usr/bin/git commit -am 'checked in from jenkins'
>> [detached HEAD 07c00f4] checked in from jenkins
>>  45 files changed, 11897 insertions(+), 3 deletions(-)
>>  create mode 100644 xxxx1.css
>>  create mode 100644 xxxx2.css
>>  create mode 100644 xxxx3.css
>>
>> + /usr/bin/git status
>> # Not currently on any branch.
>> nothing to commit (working directory clean)
>> + /usr/bin/git push
>> Everything up-to-date
>>
>>
>> I dont understand what happens after commit and before push, its not working 
>> executing shell inside jenkins or manually putting commands into jenkins.
>>
>> Require assistance, please.
>>
>> Jyotir
>>
>>
>>
>> On Thursday, 13 February 2014 19:54:20 UTC+5:30, jyotir bhandari wrote:
>>>
>>> Hi
>>>
>>> I am newbie to jenkins, and since morning I am trying to push changes to
>>> git repositories, but after git commit, it just does not executes git push
>>> command in pre build scm.
>>>
>>> I have tried tit publisher in post script but then build process just
>>> checks-out stable release available to him and after that git publish
>>> sticks to it, it commit changes are overwritten again and again.
>>>
>>> Note : I am not using github, i have my own git server.
>>>
>>> Please suggest as to how to get code checked in via jenkins.
>>>
>>> Regards
>>> Jyotir
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks!
Mark Waite

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to