我已经为Firebase实时数据库连接分叉了一个服务器端swift包:ferno,我正试图在我的Package.swift
中使用它作为依赖,如下所示:
.package(url: "[email protected]:3sidedcube/ferno.git", .branch("jwt3")),
但是当运行vapor xcode
时,我得到一个错误:
Error: Could not generate Xcode project: Completed resolution in 8.33s
error: terminated(128): git -C /Users/simonmitchell/Coding/Device-Monitor/.build/checkouts/ferno.git--4002215034454709000 checkout -f 155fa23f2f2d985dbee20072e560b095f61d7b63 output:
我已经检查了swift包的文档,这应该都是犹太教,所以为什么它不起作用?这是swift包管理器的限制吗?还是Vapor?
有时需要清除或重置包构建以使事情回到正轨。可以使用以下任一方法重置构建:
汽
vapor clean
vapor update
# Updating [Done]
# Changes to dependencies usually require Xcode to be regenerated.
# Would you like to regenerate your xcode project now?
y/n> y
# Generating Xcode Project [Done]
# Select the `Run` scheme to run.
# Open Xcode project?
y/n> y
# Opening Xcode project...
快速包经理
swift package reset # Reset the complete cache/build directory
swift package update
# Fetching https://github.com/vapor/vapor.git
# Fetching https://github.com/vapor/fluent-sqlite.git
# Fetching [email protected]:3sidedcube/ferno.git
# ...
swift package generate-xcodeproj
# generated: ./Hello.xcodeproj
open Hello.xcodeproj/
手动构建删除
rm -Rf .build
rm -Rf Hello.xcodeproj
另外,根据我的经验,Swift Package Manager .package(url: "[email protected]…)
协议需要SSH密钥对设置,以便与公共和私有存储库的远程服务一起使用。但是,.package(url: "https://github.com…)
协议不需要此设置,因为https
提供了安全的传输层。
ssh密钥对
如果还没有完成,create and setup a public/private ssh key pair for GitHub. ⇗
的〜/ .ssh /配置
### GITHUB-MY-SSH-HOST
### ADD REPOSITORY: [email protected]:_USER_NAME_/_REPOSITORY_NAME_.git
Host github.com-MY-SSH-HOST
HostName github.com
User git
IdentityFile ~/.ssh/github_privatelocal_rsa
UseKeychain yes
AddKeysToAgent yes
PreferredAuthentications publickey
注意:更新的macOS系统需要UseKeychain
和AddKeysToAgent
才能与Keychain.app
一起使用
Package.swift
在包MY-SSH-HOST
命令中明确声明已定义的git
。
.package(url: "[email protected]:3sidedcube-MY-SSH-HOST/ferno.git", .branch("jwt3"))
],
targets: [
.target(name: "App", dependencies: ["FluentSQLite", "Vapor", "Ferno"]),
// …
我发现这只是我对swift包管理器不太了解。删除.build
目录并重新尝试后,所有内容似乎都正常工作。