'Fastlane. No such file or directory - GIT_TERMINAL_PROMPT=0, can't clone repository

When I run fastlane to build project, I get error:

C:\Users\Me\AndroidStudioProjects\MyProject\MyProject-android>fastlane staging app:MyApp
[✔] 🚀
[11:56:13]: fastlane detected a Gemfile in the current directory
[11:56:13]: However, it seems like you didn't use bundle exec
[11:56:13]: To launch fastlane faster, please use
[11:56:13]:
[11:56:13]: $ bundle exec fastlane staging app:MyApp
[11:56:13]:
[11:56:13]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
+---------------------------+---------+------------------------------------+
| Used plugins |
+---------------------------+---------+------------------------------------+
| Plugin | Version | Action |
+---------------------------+---------+------------------------------------+
| fastlane-plugin-cryptex | 0.1.5 | cryptex, cryptex_generate_keystore |
| fastlane-plugin-appcenter | 2.0.0 | appcenter_codepush_release_react, |
| | | appcenter_fetch_devices, |
| | | appcenter_fetch_version_number, |
| | | appcenter_upload |
+---------------------------+---------+------------------------------------+

11:56:16: --- Step: default_platform ---
11:56:16: ------------------------------
11:56:16: Driving the lane 'android staging' 🚀
11:56:16: --------------------------------------------------
11:56:16: --- Step: Switch to android assemble_vars lane ---
11:56:16: --------------------------------------------------
11:56:16: Cruising over to lane 'android assemble_vars' 🚖
11:56:16: Cruising back to lane 'android staging' 🚘
11:56:16: ------------------------------------------
11:56:16: --- Step: Switch to android build lane ---
11:56:16: ------------------------------------------
11:56:16: Cruising over to lane 'android build' 🚖
11:56:16: ---------------------
11:56:16: --- Step: cryptex ---
11:56:16: ---------------------
11:56:16: The cryptex plugin is working!
11:56:16: Successfully loaded 'C:/Users/Me/AndroidStudioProjects/MyProject/MyProject-android/fastlane/Cryptexfile' 📄

+---------+----------------------------------------------------------+
| Detected Values from './fastlane/Cryptexfile' |
+---------+----------------------------------------------------------+
| git_url | [email protected]:MyProject/MyProject-certificates.git |
+---------+----------------------------------------------------------+

+---------------+----------------------------------------------------------+
| Summary for cryptex 0.1.5 |
+---------------+----------------------------------------------------------+
| type | export |
| out | fastlane/secrets/MyProject-ci.json |
| key |MyProject-ci.key |
| git_url | [email protected]:MyProject/MyProjectcertificates.git |
| git_branch | master |
| set_env | false |
| verbose | false |
| shallow_clone | false |
| skip_docs | false |
| digest | md5 |
+---------------+----------------------------------------------------------+

11:56:16: Cloning remote git repo...
No such file or directory - GIT_TERMINAL_PROMPT=0 git clone '[email protected]:MyProject/MyProject-certificates.git' 'C:/Users/ME1/AppData/Local/Temp/d20220514-12820-9gt23v'
11:56:16: Error cloning Repo
11:56:16: Run the following command manually to make sure you're properly authenticated:
11:56:16: $ git clone '[email protected]:MyProject/MyProject-certificates.git' 'C:/Users/ME1/AppData/Local/Temp/d20220514-12820-9gt23v'
11:56:16: 🔒 Successfully encrypted certificates repo
+------------------+-----------------+
| Lane Context |
+------------------+-----------------+
| DEFAULT_PLATFORM | android |
| PLATFORM_NAME | android |
| LANE_NAME | android staging |
+------------------+-----------------+
11:56:16: Error cloning cryptex git repo, please make sure you have access to the repository - see instructions above

+------+--------------------------------------+-------------+
| fastlane summary |
+------+--------------------------------------+-------------+
| Step | Action | Time (in s) |
+------+--------------------------------------+-------------+
| 1 | default_platform | 0 |
| 2 | Switch to android assemble_vars lane | 0 |
| 3 | Switch to android build lane | 0 |
| 💥 | cryptex | 0 |
+------+--------------------------------------+-------------+

11:56:16: fastlane finished with errors

[!] Error cloning cryptex git repo, please make sure you have access to the repository - see instructions above

But if I run : $ git clone [email protected]:MyProject/MyProject-certificates.git C:/Users/ME~1/AppData/Local/Temp/d20220514-12820-9gt23v or or if I run GIT_TERMINAL_PROMPT=0 git clone [email protected]:MyProject/MyProject-certificates.git cloning is successful.

My FastFile:

platform :android do

  desc "Assemble input vars"
  lane :assemble_vars do |options|
    # Supply package name from CLI (com.myproj.firstrapp or com.myproj.secondapp)
    # See https://github.com/fastlane/fastlane/issues/7949
    case options[:app]
      when "FirstApp"
        $apk_file = "./FirstApp/build/outputs/apk/FirstApp-release.apk"
        $package_name = "com.myproj.firstrapp"
        $task_prefix = "FirstApp"
        $appcenter_app = "FirstApp"
      when "MyProject"
        $apk_file = "./MyProject/build/outputs/apk/MyProject-release.apk"
        $package_name = "com.myproj.secondapp"
        $task_prefix = "MyProject"
        $appcenter_app = "MyProject"
      else
        raise "Invalid app name #{options[:app]}" 
    end
  end

  desc "Invoke build"
  lane :build do |options|  
    # Fetch secrets
    cryptex(
      type: "export",
      out: "fastlane/secrets/MyProject-ci.json",
      key: "MyProject-ci.key"
    )
    cryptex(
      type: "export",
      out: "fastlane/secrets/MyProject_signing.jks",
      key: "MyProject_signing.jks"
    )

    # Build
    gradle(
      task: "common:assembleRelease #{$task_prefix}:assembleRelease",
      print_command: false,
      properties: {
        "android.injected.signing.store.file" => "fastlane/secrets/MyProject_signing.jks",
        "android.injected.signing.store.password" => ENV["ANDROID_SIGNING_KEY"],
        "android.injected.signing.key.alias" => "MyProject",
        "android.injected.signing.key.password" => ENV["ANDROID_SIGNING_KEY"],
      }
    )
  end

  desc "Submit a new Beta Build to Appcenter"
  lane :staging do |options|
    # Assemble vars
    assemble_vars(
      app: options[:app]
    )

    # Invoke build
    build(
    )

    appcenter_upload(
      api_token: "********************************************************",
      owner_name: "MyProject",
      owner_type: "organization",
      app_name: $appcenter_app,
      notify_testers: true
    )

    # Notify in Slack
    if ENV["SLACK_URL"] =~ /.+/
      slack(
        message: "MyProject Android version available check your inbox!",
        channel: "#ci",
        success: true,
        default_payloads: [:git_branch, :git_author, :last_git_commit_message]
      )
    end
  end

  desc "Deploy a new version to the Google Play"
  lane :production do |options|
    # Assemble vars
    assemble_vars(
      app: options[:app]
    )

    # Invoke build
    build(
    )

    # Upload to Goodle Play
    supply(
      # Supply JSON credentials from cryptex
      json_key: "fastlane/secrets/MyProject-ci.json",
      package_name: $package_name,
      apk: $apk_file,
      # Uncomment for internal testing
      # track: "internal",
      skip_upload_metadata: true,
      skip_upload_images: true,
      skip_upload_screenshots: true
    )

    # Notify in Slack
    if ENV["SLACK_URL"] =~ /.+/
      slack(
        message: "New Google Play version ready for publishing - check the App Store, write release notes & publish!",
        channel: "#ci",
        success: true,
        default_payloads: [:git_branch, :git_author, :last_git_commit_message]
      )
    end
  end
end

# error block is executed when a error occurs
error do |lane, exception|
  if ENV["SLACK_URL"] =~ /.+/
    slack(
      message: "CI failed with exception : #{exception.to_s}",
      success: false, 
      default_payloads: [:git_branch, :git_author, :last_git_commit_message],
      # Output containing extended log output
      payload: { "Output" => exception.to_s } 
    )
  end
end


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source