Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dolt init fails if dolt config is run without global arguments #8835

Open
societal-sandpaper opened this issue Feb 7, 2025 · 4 comments
Open
Labels

Comments

@societal-sandpaper
Copy link

societal-sandpaper commented Feb 7, 2025

I think there may be one or two separate bugs covered by this.

Overall bug: It seems to be impossible to make a new repo on dolthub, and then initialize it with a non-global email/name config.

Reproduction

  1. Create a dolthub repo
  2. Bug 1: Try to clone the repo right away. Get an error like "clone failed; remote at that url contains no Dolt data". GitHub adds an initial empty commit which allows you to clone a repo right away (very helpful).
  3. Emotionally accept that you can't clone it right away.
  4. mkdir new-repo ; cd new-repo
  5. dolt init
  6. See error message (acceptable): Author identity unknown. Run dolt config... .... Omit --global to set the identity only in this repository.
  7. Run the non-global dolt config commands: dolt config --add user.email ... and dolt config --add user.name ...
  8. Bug 2: Try dolt init. See that it fails: Failed to initialize directory as a data repo. .dolt directory already exists at '.'
  9. Try dolt remote add origin .... See that it fails: The current directory is not a valid dolt repository. I suppose this is expected.

Suggested Improvements

Any of these would fix the overall . I'd suggest that all of them should be implemented:

  1. Fix Bug 1: Allow cloning a brand-new repo. (Tracked in dolt shouldn't create an init commit #2361)
  2. Fix Bug 2: Allow dolt init if the only thing in the .dolt folder of a repo is a config.json.
@timsehn
Copy link
Contributor

timsehn commented Feb 7, 2025

Part of this is a long standing feature request: #2361

The non-global thing is a great find and I'll repurpose this bug for that. @jycor will fix that today.

@timsehn timsehn changed the title New repo setup workflow fails without global name/email config dolt init fails if dolt config is run without global arguments Feb 7, 2025
@timsehn
Copy link
Contributor

timsehn commented Feb 7, 2025

I also created a dolthub-issue for cloning a new/empty database: dolthub/dolthub-issues#570

@societal-sandpaper
Copy link
Author

All sounds reasonable, thanks!

@jycor
Copy link
Contributor

jycor commented Feb 7, 2025

I have a PR in progress that allows dolt init to work when there's just a config.json in .dolt.
#8838

A potential workaround is:

$ dolt init --name 'local_user' --email 'user@local.com'
Successfully initialized dolt data repository.

$ dolt log
commit fs4mir7f918st5975popfj1vjjc6gp5l (HEAD -> main) 
Author: local_user <user@local.com>
Date:  Fri Feb 07 14:26:10 -0800 2025

        Initialize data repository

$ cat .dolt/config.json 
{"user.email":"user@local.com","user.name":"local_user"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants