herbsjs / herbs-cli

Herbs CLI
https://herbsjs.org/
MIT License
30 stars 30 forks source link

Error when create a project in Linux #152

Closed vitorgamer58 closed 2 years ago

vitorgamer58 commented 2 years ago

Describe the bug When I try to create a project on linux using herbs new, I get an error involving git.

To Reproduce Open a linux console on windows, or run it on a linux computer:

  1. Install Node 14.17.3
  2. Install Herbs-cli with npm i -g @herbsjs/herbs-cli
  3. Run herbs new
  4. Choose to initialize a git repository

Expected behavior It should create the project and present the success message.

Screenshots Screenshot_7003

dalssoft commented 2 years ago

running on Linux should be the same as on Windows or MacOS. thank you @vitorgamer58 for the bug report.

could you investigate it?

vitorgamer58 commented 2 years ago

I will

vitorgamer58 commented 2 years ago

Trying to redo the steps that the cli does with git commands, I realized that they run normally on windows, with git 2.37.1

git init
git branch -m main
git add --all
git commit -m "initial commit"

However in Ubuntu with git 2.25.1 the command git branch -m main returns an error message:

error: refname refs/heads/master not found
fatal: Branch rename failed

I managed to get it to work by changing the order of the commands, committing first and then renaming the branch:

git init
git add --all
git commit -m "initial commit"
git branch -m main

It worked, my proposal is to change the order of commands in the cli, in linux and in windows, the second order worked perfectly.