#1584  How to sync only 1 branch (master)
Closed
Artur opened 7 months 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 7 months ago

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

Artur commented 7 months 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 7 months 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

On Oct 4, 2023, at 19:49, Artur Hefczyc <artur@hefczyc.net> wrote:

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 7 months 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' 7 months ago
Previous Value Current Value
Open
Closed
Artur commented 7 months 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 4 months 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 4 months 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

On Oct 4, 2023, at 19:49, Artur Hefczyc <artur@hefczyc.net> wrote:

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 of 1
Type
Question
Priority
Minor
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
onedev/server#1584
Please wait...
Page is in error, reload to recover