# Git Clone Fails in Powershell Script During Jenkins Build

**URL:** <https://community.jenkins.io/t/git-clone-fails-in-powershell-script-during-jenkins-build/4820>\
**Category:** Ask a question\
**Tags:** linux\
**Created:** [December 2, 2022, 9:45pm UTC](https://community.jenkins.io/t/git-clone-fails-in-powershell-script-during-jenkins-build/4820 "2022-12-02T21:45:37Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![uncowandy](https://avatars.discourse-cdn.com/v4/letter/u/dfb087/32.png) [@uncowandy](https://community.jenkins.io/u/uncowandy)\
**Post date:** [December 2, 2022, 9:45pm UTC](https://community.jenkins.io/t/git-clone-fails-in-powershell-script-during-jenkins-build/4820/1 "2022-12-02T21:45:37Z")

</div>

Hello,

So I’m stumped after a day of troubleshooting.

My Jenkins Project will clone the repo where the jenkinsfile is stored in, the bitbucket repo is called “ifc4”.

One of the stages within the jenkinsfile will also clone a separate repo named “ifc3” which contains a single powershell script.

The following stage will run an execution command of the powershell script. The powershell script contains a command to clone the same initial repo, “ifc4”.

The issue here is that the script will not clone the repo “ifc4”; however when executing the powershell locally on the Linux build agent - the script will in fact clone repo “ifc4”.

This is what is shown on the jenkins console of the build:

```auto
Cloning into 'ifc4'...
fatal: could not read Username for 'https://www.bitbucketServer.com': No such device or address

```

Here’s my jenkinsfile:

```auto
pipeline { 
    agent {
        docker {
            image "xxxxxx" 
            label "xxxxxxx"
        }
    }
    environment {
        SHORT_COMMIT = "${GIT_COMMIT[0..7]}"
    }   
    stages {
       stage('ifc3: Checkout Repository') {
            steps {
              sh 'pwd'
              script{
                git credentialsId: 'service', branch: 'master', url: 'https://www.bitbucketServer.com/bitbucket/xxxxx/xxxxx/ifc3.git' 
              }   
            }
        }
        stage('Build Change: Execute Script') {
            steps {
              sh 'pwd'
              pwsh "./buildChange.ps1"
            }
        }

```

---

_[View the full topic](https://community.jenkins.io/t/git-clone-fails-in-powershell-script-during-jenkins-build/4820)._
