This study will explain:
- How to Fix the “Git author Unknown” Error Using Command Line?
- How to Fix the “Git author Unknown” Error Manually?
How to Fix “Git author Unknown” Error Using Command Line?
To fix the “Git author Unknown” error using the command line, first, redirect to the local Git repository. Then, check the Git configuration setting to ensure whether the user information has been set or not. If the user information is not added, then set the user name and email in the configuration file by utilizing the “git config –global user.email “<name>”” and “git config –global user.email “<email>”” commands.
Step 1: Redirect to Local Directory
First, switch to the particular repository by utilizing the following command:
Step 2: Generate a New File
Execute the provided command to generate an empty file in the Git working directory:
Step 3: Track Changes
Then, add the newly created file to the Git staging area using the below-given command:
Step 4: Commit Changes
To save added changes in the repository, execute the “git commit” command along with the desired commit message:
In the below screenshot, it can be seen that there is an error that says “Author identity unknown”:
To resolve the above-stated error, try out the next steps.
Step 5: Check Username
Execute the following command to check if the username is globally set or not:
No output signifies that the username is not added previously:
Step 6: Check User Email
To ensure whether the user email has been set or not, type out the following command:
As you can see, the value of the email address is empty by default:
Step 7: Set Username
Now, change the configuration setting, and add the username with the help of the below-provided command:
Here, the “–global” option is used to set the username globally, which means that all repositories that exist in the Git root directory can utilize it:
Step 8: Set User Email
Similarly, set the desired user email address by executing the following command:
Step 9: Verify Username
Next, use the below-stated command to ensure that the newly added username exists or not:
Step 10: Verify User Email
Then, verify whether the previously specified user email address has been set or not:
Step 11: Commit Changes
Lastly, run the “git commit” command to save all the staged changes in the Git current working repository:
According to the below output, the changes have been committed successfully and the error has been resolved:
How to Fix “Git author Unknown” Error Manually?
To fix the “Git author Unknown” error manually, follow the provided path on your PC and open the “.gitconfig” file in the text editor:
According to the below-given output, the “user” information is missing from the Git default settings:
Now, specify the desired username and email address in the required sections and press the “CTRL + S” keys to save changes:
We have explained the easiest solutions to resolve the “Git author Unknown” Error.
Conclusion
To fix the “Git author Unknown” error, check the Git configuration setting to see whether the username and email have been set or not. If the user information is not added, then set the username and information in the configuration setting using the “git config –global user.email “<name>”” and “git config –global user.email “<email>”” commands, or follow the “C:\Users\username\.gitconfig” path in the PC and add the author information in the “.gitconfig” file. This study provided the solutions to fix the “Git author Unknown” error.