Does user.name in Git need to match my GitHub username? - linux

I am installing Git on an Ubuntu system. I need to set user.name. I already have a GitHub account. If my full name is John Doe, and I've set up my GitHub account with the username "Jon-D", do I need to use that name for the Git user.name or can I (should I) use my full name?

No, your user.name does not matter.
However your user.email should match one of the addresses in your GitHub settings.
git config --global user.email "YOUR EMAIL"
You can also keep your email private

Related

How to fix multiple values error in git while configuring the name?

$ git config --global user.name "Amritjyot Singh"
warning: user.name has multiple values
error: cannot overwrite multiple values with a single value
Use a regexp, --add or --replace-all to change user.name.
How to use regexp to fix this problem?
I tried git config --global user.name "Amritjyot Singh"
Expected to configure my name in git bash but this error was shown
For some reason, you have multiple user.name configuration keys. Remove them all with:
git config --global --unset-all user.name
Then set it again:
git config --global user.name "Your Name"
To see where different values for a config parameter are defined :
$ git config --show-origin --get-all user.name
# sample output:
file:/home/wwhite/.gitconfig Walter White
file:.git/config Heisenberg
If you see several values coming from one single file:
file:/home/jack/.gitconfig Jack
file:/home/jack/.gitconfig Tyler Durden
you can either
edit the mentioned configuration file with a regular text editor, and delete the erroneous value,
or use :
git config [correct scope] --replace-all user.name "My Name"
where [correct scope] will probably be --global (if source is in $HOME/.gitconfig) or --local (<- same as empty string, if source is .git/config).
Run git config --global -e to edit the global config file. According to the warning and error messages, there are multiple values like this
[user]
name = foo
Find all of them, keep one and remove the others.

ubuntu throws this error: error found when loading /home/user/.profile user.name has multiple values, cant access to my laptop

i have an issue about ubuntu, when i try to login to my user, i got this error:
see the screen
the message:
warning: user.name has multiple values error: cannot overwrite multiple values with a single value Use a regexp, --add or --replace-all to change user.name.
i can successfully login to my second user, i tried to reset my git username but doesn't work
can any one help about this problem ?
Hello i have fixed the problem by changing my git username and email :
git config --global --replace-all user.name "mario"
git config --global --replace-all user.email "mario#gmail.com"

Personal Access Token not working on Linux

I am using Git on Linux.
I followed this to create a Personal Access Token but forgot to save it.
Therefore, when I was asked to enter the "password" again, I deleted the old PAT and created a new PAT. For some reason, the new token is rejected and I get
fatal: Authentication failed for 'https://github.com/username/***.git/'
When I look at the tokens page on github, this token says it was never used. What might be the issue here?
The issue might be with your current credential helper.
Type git config credential.helper to see which one is used.
Type:
printf "protocol=https\nhost=github.com"|git-credential-xxx erase
(Replace xxx by the credential helper name from the first command output)
That will clear out the cached credentials for https://github.com.
Then try again a git push, and see if it asks you for your credentials: enter your new PAT as password.
If you don't have a credential helper, I suggest installing microsoft/Git-Credential-Manager-Core (there is a Linux package).
Add a credential store, and you are set.
After discussion:
there was no credential helper
this is a personnal account (not a technical service one, used by multiple users)
the issue was with pasting the token
I would therefore use a store credential caching:
git config --global credential.helper 'store --file /home/<user>/.my-credentials
Then:
git ls-remote https://github.com/<user>/<repo>
That will trigger the prompt for your username and token.
Edit /home/<user>/.my-credentials and make sure the right token is in it.
Alternatively,
git config --global credential.helper 'store --file /home/<user>/.my-credentials'
and then:
git ls-remote https://<user>:<token>#github.com/<user>/<repo>
has worked.
I had to delete my token and create a new one and it worked for me

Git asks "please tell me who you are". Unable to auto detect email address?

Console log error :
please tell me who you are
I run this:
git config _ _global user.email"you#example.com"
git config _ _global user.email"you#example.com"
to set. your accounts default identity.
Omit _ _ global to set the identity only in this repository.
Try this :
git config --global user.name "John Doe" // config name, don't for your question
git config --global user.email johndoe#example.com
Use --global insteal of _ _global
Check Getting Started - First-Time Git Setup
If you want set for just that repository, you should modify .git/config.
--global set global config, not just one repository.

Is there a way to configure my identity from inside Git-Gui, instead of Git-CMD?

Is there a way to configure my identity from inside Git-Gui, instead of having to go through Git-CMD?
I know how to do it through CMD, as it literally tells you. I'm just wondering if I need to use the CMD.
When I tried to merge something with the GUI for the first time, it's asking me to run:
git config --global user.email johndoe#example.com
git config --global user.name "John Doe"
Yes, at least on version 0.21 you can do it by opening a git repository folder then going to Edit->Option, then edit your user name and email address in the GUI.

Resources