Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clone when user use ssh #113

Merged
merged 14 commits into from
Apr 22, 2024
Merged

fix: clone when user use ssh #113

merged 14 commits into from
Apr 22, 2024

Conversation

AlexD10S
Copy link
Collaborator

@AlexD10S AlexD10S commented Apr 19, 2024

A user reported an issue when generating the parachain:

~/github/pop
❯ pop new parachain Demo
┌   Pop CLI : Generating "Demo" using Base Parachain Template!
│
Error: authentication required but no callback set; class=Ssh (23); code=Auth (-16)

It seem our current code for cloning a repository was throwing an error, fixed using RepoBuilder. Based on this example: https://docs.rs/git2/0.13.1/git2/build/struct.RepoBuilder.html#example

After that fix user was having another issue:

~/github/pop
❯ pop new parachain my-app
┌   Pop CLI : Generating "my-app" using Base Parachain Template!

Error: remote rejected authentication: Failed getting response; class=Ssh (23); code=Auth (-16)

With seems is an issue authenticating for the SSH clone. Fixed using the library: https://crates.io/crates/git2_credentials

Also I removed Repository::init(target)?; from instantiate_base_template. After this PR #65 where we where the git init repo was introduced it gets duplicated.

How to replicate the issue:
This is tricky, I wasn't able to get same issue as the user, but if you change your way to clone, to use SSH you will see an error too in current main:
git config --global url."[email protected]:".insteadOf "https://github.com/"
A guide on how to set up SSH cloning:
https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/github-clone-with-ssh-keys

@AlexD10S AlexD10S requested review from brunopgalvao and weezy20 and removed request for brunopgalvao April 19, 2024 12:22
Cargo.toml Show resolved Hide resolved
Copy link
Contributor

@weezy20 weezy20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @AlexD10S. Only mandating changes in the error handler for git2:Config. Rest looks good.

crates/pop-parachains/src/utils/git.rs Outdated Show resolved Hide resolved
crates/pop-parachains/src/utils/git.rs Outdated Show resolved Hide resolved
@weezy20
Copy link
Contributor

weezy20 commented Apr 19, 2024

TBF, I still do not understand how to replicate this issue because we are straight up asking git2 in pop to use https. I don't understand the point of this configuration:

git config --global url."[email protected]:".insteadOf "https://github.com/"

@AlexD10S
Copy link
Collaborator Author

TBF, I still do not understand how to replicate this issue because we are straight up asking git2 in pop to use https. I don't understand the point of this configuration:

Some people set up their git configuration to clone the repositories using SSH using insteadOf

Before this fixes you can try:

git config --global url."[email protected]:".insteadOf "https://github.com/"

And this will throw an error when try to clone, because even pop has https:: your git will go with the new configuration. See this issue: rust-lang/git2-rs#901

@AlexD10S AlexD10S requested a review from weezy20 April 20, 2024 07:57
@AlexD10S AlexD10S merged commit 5891beb into main Apr 22, 2024
1 check passed
@AlexD10S AlexD10S deleted the fix-clone branch April 22, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants