loreanvictor / tmplr

Automate Code Scaffolding
MIT License
26 stars 0 forks source link

"✘ Error: error: No such remote 'origin'" #37

Closed ilyvion closed 3 weeks ago

ilyvion commented 2 months ago

Was going to start yet another project of a similar kind today, and was getting tired of copying files around manually and editing them, so I searched for a tool to do it for me, and discovered tmplr. Figured I'd give it a go. Created a local directory that I was going to use as my test-template, and added a few things to its .tmplr.yml file, before I thought it'd be a good idea to see if it even works before I put much more time into it.

Here's the result of running my npx tmplr command:

❯ npx tmplr local:C:\Users\alexs\Documents\Projects\RimworldMod\
✘ Error: error: No such remote 'origin'

👉 .tmplr.yml:3:7
1  |# .tmplr.yml

2  |steps:

3  |    - read: project_name

4  |      from: git.remote_name

5  |      fallback:

6  |          from: filesystem.rootdir

7  |

8  |    - read: clone_url

(The lines 3-6 are highlighted in red; I have no clue why each line is separated by a blank line.)

This error is not at all actionable. What am I meant to do with that information? Why isn't it using the fallback value from filesystem.rootdir if there's an issue with grabbing the git.remote_name value? Isn't that what fallbacks are for?

loreanvictor commented 2 months ago

this is a bug, and one which I'm unable to reproduce (check this repl, for example).

are you running this recipe inside a git controlled folder that simply has no remote connected?

p.s. fallback is not for when there is an error, but rather for when there is no value. git values should be empty when the recipe is executed inside a folder that is not controlled by git, but in this case the git provider is throwing an error instead.

ilyvion commented 2 months ago

In my case the folder I'm running it in is entirely empty, and the folder I'm running it on (i.e. the template) is an initalized git folder, but with no remotes and no commits (yet). After all, I was only just getting started setting up my template repo here, and testing things locally.

As for your replit link, it does not work for me, neither in Firefox nor Chrome. 🤷‍♂️

loreanvictor commented 2 months ago

In my case the folder I'm running it in is entirely empty, and the folder I'm running it on (i.e. the template) is an initalized git folder, but with no remotes and no commits (yet). After all, I was only just getting started setting up my template repo here, and testing things locally.

Thanks. Then I guess the bug stems from this issue.

As for your replit link, it does not work for me, neither in Firefox nor Chrome. 🤷‍♂️

The repl doesn't do anything on its own. You'd need to fork it and run npx tmplr to see the result. That said, the situation of the repl is not identical to the case you described (there is no git), so I don't think it is relevant anymore.

loreanvictor commented 3 weeks ago

this is resolved via v0.3.4.

ilyvion commented 3 weeks ago

Awesome, thank you. 😄 I'll give this tool another go now the next time I'm about to start yet another project of this kind!

loreanvictor commented 3 weeks ago

@ilyvion thanks for reporting the issue! I should also apologise for the long wait, as this was a pretty simple issue and I was just super swamped so couldn't update the packages faster.

anyways let me know if you face any other issues and inconveniences!