geongeorge/Git-User-Switch

Error: Command failed with exit code 1: git config user.name

eJayYoung opened this issue · 4 comments

hi, when I'was not set git config user info , execa.command will throw a Error: Command failed with exit code 1: git config user.name

I found it's caused by fetchUser below execa.command not handling errors

I know fetchUser is just for display current git user info which is get from git config user.xxx
But if not initialized git config user,like Troubleshoot, user experience is not feeling good.

a PR to fix it.

Otherwise,I've read the source code, found git-user reset will only reset user info in the Conf store,but git config user info is still exist. It's puzzle me.

In my opinion,I may want to remove git config user info as well. or add another command like remove for sync remove local git config user info

I have merged the #16

And about removing the git config user, What would happen if we git-user remove the global user? Wouldn't it remove the user from the main config

I agree with

Wouldn't it remove the user from the main config

so, what make me puzzle is, while git-user --reset the Conf store, then I run git-user command,initUser will get local git config user info as initialization data without any prompt.

For new users of git-user:

  • add a prompt selection when initUser will be friendly
  • add explain about git-user command operating principle in README
    • eg: git-user store user info list with conf, which Conf store's storage path in macOS is:~/Library/Preferences/git-user-switch-nodejs/config.json, is not sync with local git config of user, only when selectUser will cover the user git config

I got the fetchUser prompt

Current git user(local) is xxx:xxxxxxx@xxx.com

maybe acceptable to the users