Accessing a private repo as a dependancy via appcenter - bitbucket

I have the following entry in my Podfile, which points to a private repository
pod 'SDK', :git => 'https://username#bitbucket.org/private-repo.git', :branch => 'master'
When I run the build I receive the error
Cloning into '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20191115-1307-zgatx7'...
fatal: could not read Password for 'https://username#bitbucket.org': terminal prompts disabled
How can I add my Bitbucket credentials into AppCenter so that it is able to pull in this repository?
I do not want to store my password in plain text.

Related

Using Bitbucket App Password in Yocto recipe for git repo over https

On command line "git clone https://username:app-password#bitbucket.org/dir/repo.git", works, wherein app-password is an "alphanumeric string created by bitbucket"
But when using with Yocto Recipe SRC_URI = "git://username:app-password#bitbucket.org/workspace/repo.git;protocol=https;"
gives error: "fatal: could not read the password for 'https://username#bitbucket.org': No such device or address".
Please advise how to use bitbucket app-passwords in the Yocto recipe for pulling git repo over https method?
I just managed to solve this with:
SRC_URI = "git://git#bitbucket.org/myworkspace/myrepo.git;protocol=https;user=myusername:my-app-password;"
Note that the username should not be your email address but your Bitbucket username.
Hope it helps someone.

Azure DevOps Pipeline for iOS - Fastlane Match Clone Problem

I'm trying to implement iOS pipeline to Azure DevOps using Fastlane. I have already have Fastlane in my project and successfully deploy beta and pilot versions. My problem is that when I run below script on Azure pipeline, It can't pass match clone part. Therefore, can't fetch certificates, provision profiles etc..
P.S: iOS_Certificates repo is different than project repo.
I'm getting timeout error after 1 hour. I think It is about authentication to
pool:
vmImage: 'macos-latest'
steps:
- script: |
fastlane match development --clone_branch_directly --verbose
fastlane beta
displayName: 'Build iOS'
Related code in MatchFile:
git_url("git#ssh.dev.azure.com:v3/myteam/myproject/certificates_repo")
storage_mode("git")
type("development")
EDIT: I'm trying to fetch a repo inside same project inside Azure DevOps (not GitHub or somewhere else). I'm getting timeout error, so no specific error even I run --verbose on match command.
From your information, you are using the SSH key as the authentication method.
Since you are using the macos-latest(microsoft-hosted agent) as build agent, the private key of ssh key will not exist on the target build machine.
So it can't authenticate and gets stuck. As you said, it will run 60 minutes and cancel. I could also reproduce this issue.
You could try to create a self-hosted agent and run the build on it.
In this case, you need to ensure that the private key exists on the machine, then you could authenticate through the ssh key.
On the other hand, you can authenticate with username and password.
For example(matchfile):
git_url "https://organizationname#dev.azure.com/organizationname/projectname/_git/reponame"
type "development"
app_identifier 'xxx'
username "member#companyname.com" #This will be the git username
ENV["FASTLANE_PASSWORD"] = "abcdefgh" #Password to access git repo.
ENV["MATCH_PASSWORD"] = "password" #Password for the .p12 files saved in git repo.

How to set credentials in private pod in pipeline azure devops iOS project

I'm trying to make a pipeline from an iOS Project in Azure DevOps, but when I tried to install the Cocoapods, the pipeline failed because one of the pods needs credentials 'cause is a private repository. The question is:
"How can I add the credentials in pipeline agent to authenticate the private pod repository?"
I attach the screen shot from my error. screen error
As workaround , you can use a script with Pre-Job as follows:
git config --global url."https://$(GitHub.Token)#github.com/".insteadOf "https://github.com/"
And then a Post-Job script which should always run as follows:
git config --global --remove-section url."https://$(GitHub.Token)#github.com/"
You can refer to this case with similar issue .
You can add external credentials by ading a service connection.
To add a service connection you have to go to Settings => Service Connection => New service connection:
Then follow the steps to connect the service and then in your yml file you can define "externalFeedCredentials" with the name of your service this is an example for a private nuget server:
- task: NuGetCommand#2
inputs:
command: 'restore'
restoreSolution: '$(MyPathVariable)'
feedsToUse: 'config'
nugetConfigPath: '.nuget/NuGet.config'
externalFeedCredentials: 'NAME OF YOUR SERVICE'
I think you should be able to something like this for the pod repository.

Can't find SSH keys settings under travis project settings

My CI project is dependent on another private repo. So I refer to the document to upload the private key using
➜ travis sshkey --upload ~/.ssh/id_travis_rsa --pro
Updating ssh key for Jeff-Tian/uni-sso with key from /Users/tianjef/.ssh/id_travis_rsa
Current SSH key: key for clone k8s-config
Finger print: 65:25:66:26:4d:5d:9f:ac:25:ba:ea:be:c4:d5:e3:5f
From the above I double checked the finger print, and compares to the github ssh keys:
They are matched.
However, the travis build still fails by:
(https://travis-ci.com/github/Jeff-Tian/uni-sso/builds/161350192)
$ git clone git#github.com:Jeff-Tian/k8s-config.git ${HOME}/k8s-config
Cloning into '/home/travis/k8s-config'...
Warning: Permanently added the RSA host key for IP address '140.82.114.4' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The command "git clone git#github.com:Jeff-Tian/k8s-config.git ${HOME}/k8s-config" failed and exited with 128 during .
And then I check the settings on travis settings, can't find the ssh keys settings pane:
Help:
Where goes wrong? Is it a Travis CI bug?
Seems the ssh keys config is only available for private repos.
The issue here is the main repo is public, but when deploy it, a private repo need to be downloaded. This scenario is not covered by the official document.
The workaround is to switch copying the private repo via https instead of ssh, so no need to upload the ssh keys.
By setting up the GH_TOKEN in the setting, and then write that token to .netrc file. Then copy the private repo using https is working:
.travis.yml:
- echo -e "machine github.com\n login $GH_TOKEN" > ~/.netrc
- git clone https://github.com/Jeff-Tian/k8s-config.git ${HOME}/k8s-config

Jenkins Failed to Connect to Repository

I am trying to connect Jenkins to a private BitBucket repository.
I have a set (both id_rsa and id_rsa.pub) of SSH keys generated at /var/lib/jenkins/.ssh. I've copied the id_rsa.pub key and pasted it in the deploy keys section of my BitBucket repository. Similarly, running the command git ls-remote -h git#bitbucket.org:user/project.git has a valid return and has been added to known_hosts.
What might be causing my Jenkins to not connect in the git Source Code Management section of Jenkins? The error returned is:
Failed to connect to repository : Command "git -c core.askpass=true ls-remote -h https://git#bitbucket.org/user/project.git HEAD" returned status code 128:
stdout:
stderr: remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
fatal: Authentication failed for 'https://git#bitbucket.org/user/project.git/'
I also tried ssh -Tv git#bitbucket.org as per this doc from Atlassian regarding troubleshooting SSH issues. The return states at that:
This deploy key has read access to the following repositories:
user/project: Jenkins -- jenkins#ip-xxx-xx-xx-xxx
For the Project Repository field that Jenkins' Git Plugin provides, it seems that one of their examples shown in their home page for that field (specifically, https://git#bitbucket.org/user/project.git) does not work. It might either be a case of plugin version, or how BitBucket might be configured differently than GitHub, of which their documentation uses for examples.
What did work for me however, was using the git address of the following format:
git#bitbucket.org:user/project.git

Resources