Open activate-glacier-instinct opened 1 year ago
I'm assuming this error occurs when we try to commit, and since there are no local or global credentials the commit command fails.
Can you please retry with the --no-commit
flag, or by setting email environment variable (EMAIL="..." forge init ...
, commit author name defaults to the system user/hostname)?
A. forge init {PROJECT_NAME} --no-commit
was a pass for me.
For reference I created the project in an projects directory on a system with no global git configs.
1, Check git config
git config --list | grep 'user.' // Outputs nothing
ls // Outputs folders within the, ie. not an empty folder
forge init hello_foundry --no-commit // Creates the project as expected
ls // contains `hello_foundry` folder
=======
B. forge init --template {TEMPLATE} {PROJECT_NAME} --no-commit
was a fail
I also wanted to test project creation from a template. Feels like most users would want to use this scaffolding.
Got the following error
error: the argument '--template <TEMPLATE>' cannot be used with '--no-commit'
Usage: forge init --template <TEMPLATE> <ROOT>
For more information, try '--help'.
=======
C. Comments
When purely looking at forge-init
as a project scaffolding tool, the committing of the scaffold seems odd.
I'm comparing it to other large scaffolding tools: create-react-app (98.7k stars on Github)
For example create-react-app doesn't init the repo for the user:
0.1 Pre-requisites
npx create-react-app test-react
ls test-react // Outputs project files
cd test-react && git status
Outputs:
fatal: not a git repository (or any of the parent directories): .git
``
=======
D. Thank you
Thanks a lot @DaniPopes I can move forward with the `--no-commit` workaround.
A. great, I guess we could make the error clearer for future users
B. that's definitely a bug, easy fix for anyone to implement: just remove the "conflicts" in the clap args and put the template commit under an if block
C. It really depends on the framework as well. Rust projects initialized with Cargo also start with a vcs (like git). But also this is nice for Foundry since we are still using git submodules as dependencies
Component
Forge
Describe the feature you would like
Being able to run forge init on a system that does not have global git settings configured.
Requested behaviour
Current behaviour
Output:
Additional context
Background Most of my crypto work is anon, so I don't globally set my git credentials. I set them up per repo using scripts.
This is the reason why I'm running the above command in an empty folder.
Setting up a foundry project within a pre-initialised repo also doesn't work. More on that here: https://github.com/foundry-rs/foundry/issues/4214