I am trying to automatically clone my Bitbucket via a powershell script. I am currently using the following line of code:
git clone https://myUsername@bitbucket.org/project1/project1-database.git --quiet
This works as far as it goes, but I would prefer that you have to log in first to clone the repositories because others should also use the script. I have found the following:
Import-Module BitbucketPS
New-BitBucketSession -Credential (Get-Credential "")
This will create a window where you can enter your credentials. Unfortunately, an error message appears when executing the script:
Import-Module : The specified module "BitbucketPS" was not loaded, because no valid module file was found in any module directory. module file was found.
My question is how do I extend my script to import the module and connect to BitBucket from the login window?
UPDATE 1
if( -not (Test-Path -Path $path+\project1-database -PathType Any ))
{
git clone https://bitbucket.org/project1/project1-database.git --quiet
}
else
{
Set-Location $path+\project1-database
git pull https://bitbucket.org/project1/project1-database.git --quiet
}