# Cannot fetch branches from 2 different repos

**URL:** <https://community.jenkins.io/t/cannot-fetch-branches-from-2-different-repos/2072>\
**Category:** Using Jenkins\
**Tags:** git\
**Created:** [April 11, 2022, 2:38pm UTC](https://community.jenkins.io/t/cannot-fetch-branches-from-2-different-repos/2072 "2022-04-11T14:38:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jitendern](https://avatars.discourse-cdn.com/v4/letter/j/bbce88/32.png) [@jitendern](https://community.jenkins.io/u/jitendern)\
**Post date:** [April 11, 2022, 2:38pm UTC](https://community.jenkins.io/t/cannot-fetch-branches-from-2-different-repos/2072/1 "2022-04-11T14:38:06Z")

</div>

Hi ,

I need to create a build with parameter job in which i need to ask for 2 branches from different repository , I am using declarative pipeline script for it and the stranger is that it is working in one case and not working for other.

CASE 1 (which is working):

parameters{  
gitParameter branchFilter: ‘origin/(._)’, defaultValue: ‘master’, name: ‘BRANCH’, quickFilterEnabled: true, type: ‘PT\_BRANCH’, \*useRepository: '.www-wordpress.git’  
gitParameter branchFilter: 'origin/(._)’, defaultValue: ‘main’, name: ‘BRANCH\_INFRA’, quickFilterEnabled: true, type: ‘PT\_BRANCH’, \*_useRepository: '.infra.git’_  
}  
stages {  
stage(‘getting Branches’) {  
steps {  
git branch: “${params.BRANCH}”, credentialsId: ‘abc’, url: '**[git@github.com](mailto:git@github.com):abc/www-wordpress.git’**  
git branch: “${params.BRANCH\_INFRA}”, credentialsId: ‘abc’, url: '**[git@github.com](mailto:git@github.com):abc/infra.git’**  
}  
}

CASE 2 (not working)

Now if I can the repo to :  
1)git@github.com:abc/now-gg-game-dev-console-frontend.git  
2)git@github.com:abc/now-gg-game-dev-console-adminui.git

then it only shows branches for the first branch parameter that is declare if use frontend repo first then it shows branches of first repo and shows error for second and vice versa

images attached:

 ![Screenshot 2022-04-11 at 8.04.56 PM](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/5/5c3f1e2380f549ef873b96ec8ffbeed1a85dee7a.jpeg)

code used:  
parameters{  
gitParameter branchFilter: ‘origin/(.\*)’, defaultValue: ‘master’, name: ‘BRANCH\_FRONTEND’, quickFilterEnabled: true, type: ‘PT\_BRANCH’, useRepository: ‘._now-gg-game-dev-console-frontend.git’  
gitParameter branchFilter: 'origin/(._)’, defaultValue: ‘master’, name: ‘BRANCH\_BACKEND’, quickFilterEnabled: true, type: ‘PT\_BRANCH’, useRepository: ‘.\*now-gg-game-dev-console-adminui.git’  
}

```
stages {
    stage('getting Branches') {
        steps {
            git branch: "${params.BRANCH_FRONTEND}", credentialsId: 'abc', url: 'git@github.com:abc/now-gg-game-dev-console-frontend.git'
            git branch: "${params. BRANCH_BACKEND}", credentialsId: 'abc', url: 'git@github.com:abc/now-gg-game-dev-console-adminui.git'

        }
    }

```

Your help will be appreciated
