[Solved] We couldn't find the existing account, Gitlab Mattermost 8

I know this is covered here, and there is a solution here, but I’m still having this issue.

I have gitlab omnibus CE 8.1.3

I’ve followed the steps in the troubleshooting guide, but I’m having a problem.
First: The solution states that these steps are for an account that has System Admin prvileges, but I’m assuming it works for normal accounts too

Second: Step a.b. says “Change email for account to random address so you can create a new GitLab SSO account using your regular address”. Since the user can’t log in to change his address, and I can’t seem to find a way to change his address as an admin…how do I change his address? I’m guessing there’s either a way I’m not seeing in the UI, or I need to do it by directly connecting to the database. I just didn’t want to do that until I have some verification that I wouldn’t totally bork anything.

If I do need to connect to the DB to change the email address, does mattermost have a separate DB from gitlab, and how do I connect to the mattermost db? I’m kind of afraid to go in and change anything I’m not certain of since it would be pretty terrible to mess up their gitlab account.

Any help is greatly appreciated.

If you’re running Mattermost 1.3+ you can do the following:

Ok, as an admin you don’t have direct access through the UI to change the user’s email address (this is a feature we’d like to add as we expand the functionality of the System Console).

You can fix this by permanently deleting the user’s Mattermost account (don’t worry it won’t touch their GitLab account). The command to do this is:

platform -permanent_delete_user -team_name="name" -email="user@example.com"

They should then be able to go and create a new account using GitLab SSO.


  1. This will totally wipe out any posts that the user has made before.
  2. Strongly suggest backing up your DB before attempting this.

There is also the possibility of manually updating the email address to something random so you don’t have to delete the user but we super strongly suggest no one messes directly with the DB.

Thanks to jwilander for helping me out so much with this. I’m leaving his answer up in case someone else has this problem with version 1.3+, but he helped me in chat, and here’s what we did.

I needed to change the username and email address of the user that is now blocked. Meaning, I have to put in different values so that that user can recreate their account, using the same username and email, and the old account sits there, with dummy information.

For this “guide” I’ll pretend like my co-workers name is John Doe

Here’s how I did it (once again with very patient help from jwilander)

Log into the gitlab omnibus postgres db
Found here

sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production

Connect to the mattermost table

\connect mattermost_production;

Change the username and email values of the broken account

UPDATE users SET email = 'anyTrashValue@example.com' WHERE email = 'john.doe@example.com';

UPDATE users SET username = 'fakeName' WHERE username = 'john.doe';

If you aren’t sure what their username/password are, and they aren’t available, you can check it using
SELECT * FROM users;
or, if you know their name
SELECT * FROM users WHERE username = 'john.doe';
now you can see what email they used.

Log in again
Now resend them a login link to your team, and you should be all done.

Thanks again for the help

1 Like