I'm using ssh key for git, after I added ssh key and check it authenticated successfully. But I still cannot commit code
$ eval "$(ssh-agent -s)"
Agent pid 2599
$ ssh-add ~/id_rsa
Identity added: /home/vagrant/id_rsa (/home/vagrant/id_rsa)
$ssh -T [email protected]
Hi my-git-username! You've successfully authenticated, but GitHub does not provide shell access.
But I cannot do commit
$ git commit -m "Develop Dockerfile for shopContainer"
*** Please tell me who you are.
Run
git config --global user.email "[email protected]"
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: unable to auto-detect email address (got 'vagrant@vagrant-ubuntu-trusty-64.(none)')
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Note: You are authenticated successfully but git needs your username & email
to do a commit.
It is not related to authentication. Your username/email
can be different from your GitHub Account.
You need to run the following commands for a single time.
$ git config --global user.email "[email protected]"
$ git config --global user.name "Your Name"
$ git config --list # see if the 'name' & 'email' are set correctly
This user.name
& user.email
will be set globally in ~/.gitconfig
file.
$ cat ~/.gitconfig # see global config file
See more details
The suggestions from other answers no longer work in 2020. To remove the repeated entries, this is now the way to go:
git config --global --unset-all user.name
git config --global --unset-all user.email
You might have to unset them locally as well, i.e. no --global flag. Then set them again as indicated in the other answers, i.e.:
$ git config --global user.name "Your Name"
$ git config --global user.email "[email protected]"
This error tells you to omit the --global from the command nothing else. to get rid of this error follow my steps...
just put this command in your git console ->
$ git config user.email "[email protected]"
$ git config user.name "Your name"
after this, your name and email will be set to the git and you are now ready to commit.
$ git commit -m "Msg you want to print during commit" ##This will commit successfully##
Output ->
[master (root-commit) 7d5681a] done
1 file changed, 1 insertion(+)
create mode 100644 demo.txt
please let me know me if it is helpful to you guys.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With