CoderMonkey CoderMonkey - 1 month ago 14
Git Question

Can't commit to CodeCommit

I'm not able to commit any files to my new CodeCommit repository, not sure why.

I've been able to clone my repository, so I'm able to connect to it. This would seem to rule out authentication issues. However, once I add and then commit a file I get the following error:

$ git commit -m "test"
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <(null)>) not allowed


I've created an IAM user with the AWSCodeCommitPowerUser policy attached to it. This is the user currently configured by calling aws configure on the command line.

I've checked
git config --global -l
and it does return the contents of
.gitconfig
, so it is picking up the gut config setup as per AWS guidelines. The contents of this file are as follows:

[credential]
helper = !aws codecommit credential-helper --profile=IAMUserName $@
UseHttpPath = tru


I'm really not sure what I'm missing here. I can connect to the repository and clone it, and my config looks to match the contents of the tutorial but I can't commit. I've tried removing the
--profile
part of the
.gitconfig
file but this hasn't resolved the issue either.

Can anyone advise what I'm missing here?

Answer

As stated by the error message, you are not able to sign-off your commits without specifying an author name and email address.

Execute the following commands in the repository before committing:

git config user.email "code@mon.key"
git config user.name "Code Monkey"

and then commit:

git commit -m "test"