SPM show-dependencies broken

I have a Package.swift

// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
  name: "SharedUI",
  defaultLocalization: "en_US",
  platforms: [.iOS(.v16)],
  products: [
    .library(
      name: "SharedUI",
      targets: [
        "AppTheme",
      ]
    ),
  ],
  dependencies: [
    .package(url: "https://github.com/apple/swift-markdown.git", "0.2.0"..<"0.3.0"),
  ],
  targets: [
    .target(
      name: "AppTheme",
      dependencies: [
        .product(name: "Markdown", package: "swift-markdown"),
      ],
      path: "AppTheme"
    ),
  ]
)

Run swift package show-dependencies shows error

yuantong-macbookpro2:Downloads yuantong$ swift package show-dependencies
Fetching https://github.com/apple/swift-markdown.git from cache
Fetched https://github.com/apple/swift-markdown.git (0.67s)
error: Couldn’t get the list of tags:
    fatal: cannot use bare repository '/Users/yuantong/Downloads/.build/repositories/swift-markdown-b692ce3c' (safe.bareRepository is 'explicit')

which I think used to work before Xcode 15.

Answered by DTS Engineer in 810620022

Given that this reproduces when using Swift PM from the command-line [1], you might have more luck asking about it over on the Swift Forums. That’s where the Swift PM experts hang out (-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] While Xcode can use Swift packages, the way that Xcode builds packages is somewhat different than the command-line tool. Thus, if you have a package problem when building from within Xcode, that’s more of an Apple thing. However, if you have a problem when working with the command-line tool, that’s fair game for the Swift Forums.

Hello, did you find a solution to your problem?. I am the same issue (different repo).

Hello, I have the same problem trying to import any swift package. It fails from Xcode SPM and even from command line using the command xcodebuild -resolvePackageDependencies. The error:

fatal: cannot use bare repository '/Users/user/Library/Caches/org.swift.swiftpm/repositories/Factory-25e11c6f' (safe.bareRepository is 'explicit') Couldn’t get the list of tags: fatal: cannot use bare repository '/Users/user/Library/Developer/Xcode/DerivedData/TestSPM-fgkuhljabyfncxcrtjxfpeyobjus/SourcePackages/repositories/Factory-25e11c6f' (safe.bareRepository is 'explicit')

Any solution? Thanks

I am also facing this issue right now. wth is that?

Given that this reproduces when using Swift PM from the command-line [1], you might have more luck asking about it over on the Swift Forums. That’s where the Swift PM experts hang out (-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] While Xcode can use Swift packages, the way that Xcode builds packages is somewhat different than the command-line tool. Thus, if you have a package problem when building from within Xcode, that’s more of an Apple thing. However, if you have a problem when working with the command-line tool, that’s fair game for the Swift Forums.

I removed the following entry from ~./.gitconfig file:

[safe] bareRepository = explicit

and now it is working.

I could reproduce on a brand new project with https://github.com/apple/swift-log.git

I've opened a thread on the Swift Forum. I hope we can get some help there. https://forums.swift.org/t/fatal-cannot-use-bare-repository/75588

Also, the solution mentioned by ndebei79 works if that can help some.

I upgraded SourceTree this morning and the problem started. The upgrade added:

[safe]
    bareRepository = explicit

to ~/.gitconfig.

I removed it and Xcode worked again.

A bug has been filed with Atlassian. https://jira.atlassian.com/browse/SRCTREE-8176

SPM show-dependencies broken
 
 
Q