I want to download a specific file ("Web/Externals/Settings.txt") in a folder(which is not having git) from my bit bucket repository "TestRepository" with branch name "TestBranch".
Please suggest
Note: I need the file as it is.
function CheckOutDevFile($userName, $password, $CheckOutFilePath, $RepoUrl){
$userNamePaswords = "$($userName):$($password)"
$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($userNamePaswords))
$authorization = "Basic $encodedCredentials"
$Headers = @{ Authorization = $authorization }
Invoke-RestMethod -Headers $Headers $RepoUrl -OutFile $CheckOutFilePath
}
$userName = 'Your User name'
$password = 'Your password'
$CheckOutFilePath = 'Your out put location with file name'
$RepoUrl = 'https://{CompanyRepoUrl}/projects/{PojectName}/repos/{RepoName}/raw/{SpecificFilePath}?at=refs/heads/{BranchName}'
CheckOutDevFile $userName $password $CheckOutFilePath $RepoUrl
I have tried that and I get the following error:
Invoke-RestMethod : Unable to connect to the remote server
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.