bitrise-steplib/steps-xcode-archive

Cannot fetch private Swift Package

danipralea opened this issue · 2 comments

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

 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

  1. I created a new user on github with username githubbitrisedecor
  2. 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)
  3. I added that keypair to my newly created user.
  4. I added my newly created user on my package collaborators list with Read permissions.

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.

@danipralea The answer by @fredbovy is the correct solution, we recommend using the netrc step for this.