hello, I’ve been following the developer quickstart guide to build the counter contract.
forc build
command gives me this error:
Error: failed to fetch `https://github.com/fuellabs/sway`. Check your connection or run in `--offline` mode
Caused by:
authentication required but no callback set; class=Ssh (23); code=Auth (-16)
Following the error message, I tried this: forc build --offline
and got this error:
Error: Unable to fetch pkg "std" from Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("github.com")), port: None, path: "/fuellabs/sway", query: None, fragment: None } in offline mode
2 Likes
Are you trying to compile without internet connection?
1 Like
The Internet connection is fine. Looks like the issue happens due to git authentication issue mentioned here
Editing global github config worked for me.
2 Likes
See the temporary workaround mentioned in this issue comment:
opened 03:40AM - 23 May 22 UTC
forc
P: high
forc-pkg
Git is used by `forc` to enable support for remote git dependencies and remote p… roject templates. The fetching and handling of git repositories is performed in `forc-pkg`.
## Problem
Currently we don't do any sort of authentication handling for git within `forc-pkg`.
So far this hasn't caused too many issues as all existing forc projects only have public repository dependencies and they all use `http`/`https` URLs. However, once we start opening up to more users I can see us quickly getting a bunch of issues about this.
The main issues with not handling git authentication are:
1. **URL types other than http/https don't seem to work without it**. I don't think git URLs like `git@github.com:FuelLabs/sway.git` work at the moment, and I believe this might be due to our lack of authentication handling.
2. **No support for private dependencies**. Normally git can support fetching and updating private repositories via ssh as long as the git URL format is used, however trying to do so with forc just panics at the moment.
3. **Some git URL rewrite rules don't work**. Some users use re-write rules so that URLs starting with `http`/`https` automatically get rewritten to git URLs. As a result of 1. forc will just panic. This is the source of this issue:
- https://github.com/FuelLabs/sway/issues/998.
## Potential Solution
We should investigate how `cargo` handles this.
Some high-level docs about cargo's support for git authentication can be found here: https://doc.rust-lang.org/cargo/appendix/git-authentication.html.
Investigate cargo's [`git::utils::with_authentication` function](https://github.com/rust-lang/cargo/blob/b1636fc1e049e977ae542ec2b2191ffab075b049/src/cargo/sources/git/utils.rs#L448) which provides a scope with valid git auth. This function seems to be the primary part of `cargo`'s code-base responsible for handling git authentication.
The full solution is for us to handle git authentication properly in forc
, which is one of our priorities before the next beta!
4 Likes
system
Closed
February 20, 2023, 3:33am
6
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.