Skip to content

Error regarding if git is not configured.#355

Open
patil-tanv wants to merge 5 commits into
HewlettPackard:masterfrom
varkha-d-sharma:git_config_unset
Open

Error regarding if git is not configured.#355
patil-tanv wants to merge 5 commits into
HewlettPackard:masterfrom
varkha-d-sharma:git_config_unset

Conversation

@patil-tanv

@patil-tanv patil-tanv commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Related Issues / Pull Requests

This PR added error message while doing cmf init if git configuration is not done on system.

Description

While running cmf init command the git config is must else user will not able to proceed.

What changes are proposed in this pull request?

Added error message if git username or user email is not configured on system while running cmf init command. If git config is done properly then cmf init will be successful.

Checklist:

  • My code follows the style guidelines of this project (PEP-8 with Google-style docstrings).
  • My code modifies existing public API, or introduces new public API, and I updated or wrote docstrings that
    uses Google-style formatting and any other formatting that is supported by mkdocs and plugins this project
    uses.
  • I have commented my code.
  • My code requires documentation updates, and I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Adding screenshot for reference
image

Comment thread cmflib/cmf_commands_wrapper.py Outdated
Comment thread cmflib/cmf_exception_handling.py Outdated
@patil-tanv
patil-tanv requested a review from AyeshaSanadi June 23, 2026 11:28
Comment thread cmflib/dvc_wrapper.py Outdated
user_name = user_name.strip()
user_name_return_code = process.returncode

logger.info(f"[check_git_config] Git user.name check - Return code: {user_name_return_code}, Value: '{user_name}', Stderr: '{stderr_name.strip()}'")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Send this to logger.debug

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

Comment thread cmflib/dvc_wrapper.py Outdated
user_email = user_email.strip()
user_email_return_code = process.returncode

logger.info(f"[check_git_config] Git user.email check - Return code: {user_email_return_code}, Value: '{user_email}', Stderr: '{stderr_email.strip()}'")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send this to logger.debug.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread cmflib/dvc_wrapper.py Outdated
missing_configs.append("user.name")
if not user_email:
missing_configs.append("user.email")
logger.warning(f"[check_git_config] Git configuration INCOMPLETE. Missing: {', '.join(missing_configs)}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Send this to logger.debug and it does not matter even if either one -user or email is missing, it is always an error.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread cmflib/dvc_wrapper.py Outdated
logger.error(f"[check_git_config] Exception occurred: {err}, Type: {type(err)}")
git_config_valid = False

logger.info(f"[check_git_config] Final result: {git_config_valid}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be giving this to user. User would already if they have configured user.name and user.email

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants