【发布时间】:2021-08-04 03:03:57
【问题描述】:
我对 Scala 和 SBT 完全陌生。我有 SBT 1.3.2 的 downloaded .tgz 存档,将其解压缩并将其 bin 目录添加到我在 Ubuntu 18.04 上的 PATH 中。
我正在关注official Getting Started guide,它提供了一个创建简单项目的命令。它应该这样运行:
$ sbt new sbt/scala-seed.g8
....
Minimum Scala build.
name [My Something Project]: hello
Template applied in ./hello
相反,它要求我提供凭据:
$ sbt new sbt/scala_seed.g8
[info] Set current project to code (in build file:/home/user/code/)
[info] Set current project to code (in build file:/home/user/code/)
Username:
我不知道该输入什么。我什至无法猜测,因为在它要求输入密码之前我只能输入一个字符。如果我再次输入一个字符,我会再次收到用户名提示。这是按两个键后的输出:
$ sbt new sbt/scala_seed.g8
[info] Set current project to code (in build file:/home/user/code/)
[info] Set current project to code (in build file:/home/user/code/)
Username: Password:
Username:
我只想设置一个基本项目。我做错了什么?
【问题讨论】:
-
可能是底层的 git checkout 要求提供凭据。尝试独立的 git checkout/clone:
git clone git@github.com:scala/scala-seed.g8.git /tmp/scala-seed.g8看看是否可行。 -
当我进一步前进时收到此消息时,似乎有些东西正在尝试与 github 帐户连接:
https://github.com/scala/imba-hello.g8.git: not authorized所以为了回答这个问题,我们需要知道如何绕过 github 登录过程,而只是下载项目。 -
@mana 的答案可以解决问题,但对于新人来说,这很简单:
git clone git@github.com:scala/scala-seed.g8.git scala-seed.g8(或您可能喜欢的项目名称 -
这里的问题是模板名称不正确,所以我在下面回答得很清楚。
标签: sbt