How to sync only 1 branch (master) (OD-1584)
Artur opened 2 years ago

I have a job to sync github repository to my repo in 1dev. I use "Repository Sync"/"Pull from Remote".

I created the job following the online instructions, however, this build attempts to sync all branches which causes lots of problems as remote branches are deleted or changed and it leads to job failure.

However, I am only interested in syncing master branch really. I suspect that I should set it somehow in "Refs" field, but what exactly should I put there to sync only master branch?

  • Robin Shen commented 2 years ago

    @kobit to sync only master branch, just change refs field as refs/heads/master

  • Artur commented 2 years ago

    Thank you for your response.


    However, I put: 
    refs/heads/master refs/tags/*
    Just to get all the tags as well and the build still puls all the branches.


    Artur
  • Artur commented 2 years ago

    I am sorry, I take it back. It did not pull all the branches.

    However, there are some new branches created which are not even on the target repo. I do not know where these came from. Still investigating. 

    Artur


    Thank you for your response.

    However, I put: 
    refs/heads/master refs/tags/*
    Just to get all the tags as well and the build still puls all the branches.


    Artur
  • Robin Shen commented 2 years ago

    If refs are specified as master refs/tags/* OneDev internally calls git fetch <remote> master:master refs/tags/*:refs/tags/* to do the job. It should not fetch unspecified branches.

  • Artur changed state to 'Closed' 2 years ago
    Previous Value Current Value
    Open
    Closed
  • Artur commented 2 years ago

    Thank you, I confirm it all works as expected.

    Those 2 strange branches, I still do not know where they came from. Most likely some old branches I missed while removing. All subsequent job execution pulled only master and tags.

  • Artur commented 2 years ago

    Thank you for your response.


    However, I put: 
    refs/heads/master refs/tags/*
    Just to get all the tags as well and the build still puls all the branches.


    Artur
  • Artur commented 2 years ago

    I am sorry, I take it back. It did not pull all the branches.

    However, there are some new branches created which are not even on the target repo. I do not know where these came from. Still investigating. 

    Artur


    Thank you for your response.

    However, I put: 
    refs/heads/master refs/tags/*
    Just to get all the tags as well and the build still puls all the branches.


    Artur
issue 1/1
Type
Question
Priority
Minor
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-1584
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover