Closed spdegabrielle closed 2 years ago
@nixin72
did a test by changing the script on my local machine after re-reinstalling from-template
I updated the .sh file;
#!/bin/bash
echo "$1$2.git"
git clone "$1$2.git" $3
if [ -d "$3" ]; then
cd "$3"
rm -rf .git
else
echo "Cloning $1$2 failed"
fi
running clearly shows it is using ssh
spdegabrielle@Miriams-MacBook-Pro qi-experiments % raco new qi-tutorial qe2
git@github.com:countvajhula/qi-tutorial.git
Cloning into 'qe2'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
spdegabrielle@Miriams-MacBook-Pro qi-experiments %
(define ssh? (make-parameter #f))
(module+ main
(define cli-args
(command-line
#:program "from-template"
#:once-any
[("-l" "--list")
"Lists all available templates to clone"
(listing? #t)]
[("-s" "--ssh")
"Clone over ssh instead of https"
(ssh? #t)]
parameter check
(define [clone-repo repo-name dir-name]
(define protocol (if ssh? "git@github.com:" "https://github.com/"))
(case (system-type 'os)
[(unix)
(system (string-append "bash " (path->string linux-script) " " protocol " " repo-name " " dir-name))]
[(macosx)
(system (string-append "bash " (path->string macosx-script) " " protocol " " repo-name " " dir-name))]
[(windows)
(system (string-append (path->string windows-script) " " protocol " " repo-name " " dir-name))]))
@nixin72 I'm mystified how ssh is triggering
given this is just cloning a template; do see a problem with removing the protocol code, and defaulting all template cloning to https: on all platforms?
@spdegabrielle
@spdegabrielle In that code sample, looks like there are missing parens around the parameter check so it would always return true. i.e. should be:
(define protocol (if (ssh?) "git@github.com:" "https://github.com/"))
Hey, sorry for not being responsive, just got back from holidays!
@spdegabrielle I don't want to always use https. HTTPS can be a pain with 2FA and randomly generated passwords that are stored in a password keeper like Bitwarden or 1password. I personally have no idea what my GitHub or GitLab passwords are and have 2FA set up, so using HTTPS workflow isn't worth setting up for me.
Sorry for the mistake, I don't use Racket much these days, but yes since ssh?
is parameterized I think it needs to be called like (ssh?)
.
No problem. I hope you enjoyed your holidays.
https works anonymously for cloning repos. Passwords and 2fa are not an issue.
I’ll make a pr to change to (ssh?)
I really appreciate your contributions, but I respect your wishes if you would like to step away due to a change in interests.
If you do want to step away we can fork to the racket templates organisation and make that the source of the package on the packet catalog.
Bw Stephen
tested - fix confirmed. Thank you @countvajhula @countvajhula
Hmm, you make a good point about the anonymous cloning - and repos will always be public since they have to be in Racket templates, so you'll never need auth. Yea, you're right that https-only would've worked fine, I guess I overlooked why I wanted SSH available since it doesn't really matter at the end of the day for this case.
Either way, it's fixed and the issue is closed. Thank you for handling it.
It probably wouldn't be a bad idea to fork this into racket-templates
and move to that one though. I'm doing less and less programming in my spare time these days unfortunately, and what I do end up doing usually isn't Racket. It would probably be better to have the project live there with people more in-touch with the ecosystem and familiar with the language.
Just found this. Still looking into it.