It's not git push
that's using your username + hostname, it's git commit
.
By default, if you did not set user.name
and user.email
BEFORE making a commit, git will get it from your computer name and hostname. It would also have shown you a warning like this:
Committer: user1234 <user1234@mac.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file1.txt
When you do git push
, it would just use whatever was set as the commit author and push it to the remote repo.
What I think happened, is that you already committed BEFORE you set the correct user.name
and user.email
settings. So those commits you're trying to push already has that invalid user details "SamLogan@logath-T460.mycompany.com" saved as the commit author.
What you need to do then is to update the author of the previous commits.
First, make sure to properly set the user.name
and user.email
config (--global
or --local
to the repo), otherwise known as your Git identity.
git config --global user.name "yourname"
git config --global user.email "yourname@youremail.com"
Set it now to the correct identity that matches the user account of your Gitlab repo.
Then use --reset-author
on those commits.
After that, git push
should now work.