Cannot fetch private Swift Package
danipralea opened this issue · 2 comments
danipralea commented
Troubleshooting
- I've searched discuss.bitrise.io for possible solutions.
- Which version of the step is effected? 4.3.0
- Is the issue reproducible with the latest version? YES
- Does the issue happen sporadically, or every time? EVERY TIME
- Is the issue reproducible locally by following our local debug guide? NOT APPLICABLE
Useful information
Issue description
I cannot git clone a private Swift Package
Bitrise info
- Build URL: https://app.bitrise.io/build/0a1af70c-355a-4083-ad0c-f08c0632800f
- Bitrise Support enabled: YES
- Log:
Fetching from https://github.com/[REDACTED]matters/DMHoneycomb Failed to clone repository https://github.com/[REDACTED]matters/DMHoneycomb: Cloning into bare repository '/Users/[REDACTED]/Library/Developer/Xcode/DerivedData/DecorMatters-ggqgvheodnxkujdhyeixaghasoam/SourcePackages/repositories/DMHoneycomb-85cea6e4'... fatal: could not read Username for 'https://github.com': terminal prompts disabledxcodebuild: error: Could not resolve package dependencies: Failed to clone repository https://github.com/[REDACTED]matters/DMHoneycomb: Cloning into bare repository '/Users/[REDACTED]/Library/Developer/Xcode/DerivedData/DecorMatters-ggqgvheodnxkujdhyeixaghasoam/SourcePackages/repositories/DMHoneycomb-85cea6e4'... fatal: could not read Username for 'https://github.com': terminal prompts disabled Skipping cache due to an error: Failed to clone repository https://github.com/[REDACTED]matters/DMHoneycomb: Cloning into bare repository '/Users/[REDACTED]/Library/Caches/org.swift.swiftpm/repositories/DMHoneycomb-85cea6e4'... fatal: could not read Username for 'https://github.com': terminal prompts disabled
Steps to reproduce
- I created a new user on github with username githubbitrisedecor
- I went on Bitrise app Settings page and re-generated a SSH keypair (tried using the existing one, but I was getting an error that it was already in use)
- I added that keypair to my newly created user.
- I added my newly created user on my package collaborators list with Read permissions.
fredbovy commented
As a workaround we use an "authenticate host with netrc step" for the private repos.
https://github.com/bitrise-steplib/steps-authenticate-host-with-netrc
Hope this will help.
ofalvai commented
@danipralea The answer by @fredbovy is the correct solution, we recommend using the netrc step for this.