There's already another gitlab account being used. So all the git commits are being recorded in this account. How do I change this account? I tried changing git users the git way. git config --list shows the changed user but still the above gitlab account is being used. Any suggestion will be helpful.
Asked
Active
Viewed 583 times
0
-
GitLab (like most other hosted Git services) identifies users by the email address in the commit metadata. To assign a different author to your commits you have to change this email address. This can be done using `git config user.email "new@email.address"`. – Henri Menke Jul 28 '20 at 07:40
-
This didn't work – Anish Tandukar Jul 28 '20 at 09:12
-
It doesn't retroactively. This will only apply to new commits. – Henri Menke Jul 28 '20 at 11:10
1 Answers
1
You are likely using a shared local account, which is not recommended, but everybody does anyway. The Gitlab login is using the ssh key, and the key is linked to a different account.
You can:
- use nominative users instead of a shared account (recommended), each will have its own ssh keys and configuration;
- configure multiple keys and multiple remotes (see Multiple GitHub Accounts & SSH Config);
- change the SSH keys linked to the current account with your own (if you are the only one currently using that shared account) or unlink that SSH key from the previous user, and link it to your user on Gitlab (this is by far the worse solution);
- use HTTPS instead of SSH (this -by default- will ask for credentials each time you pull/push/etc, allowing more users to use their credentials each time)

Iron Bishop
- 1,749
- 1
- 7
- 16