Skip to content

Importing from GitHub with omniauth associated does not associate commit author

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When importing a project from GitHub after all users have registered and associated their GitHub account under social login their commits are not associated with their gitlab user. Issues appear to associate properly (so far).

The issue appears to stem from GitHub users that have changed their email address in the past. The importer only associates commits from the most recent address with their GitHub user in the API. I have tried having the users add their additional past email addresses under settings -> email accounts and this did not make a difference in the import process.

Steps to reproduce

  1. Create a repository on GitHub
  2. Commit to repository
  3. Change email address in GitHub of the user that committed
  4. Commit to repository with the new email address
  5. Register the user with GitLab and associate their GitHub account using omniauth
  6. Import the repository

Expected behavior

All commits should be associated with the correct author associated with the GitHub user.

Actual behavior

Commits before the email address change are not associated with the correct author associated with the GitHub user.

Relevant logs and/or screenshots

If there is a log of the import thats helpful let me know where it is and I'll post it.

Output of checks

Results of GitLab application Check

root@gitlab:~# docker exec -it gitlab gitlab-rake gitlab:check SANITIZE=true
I, [2017-02-11T19:30:39.578694 #5855]  INFO -- sentry: ** [Raven] Raven 2.0.2 ready to catch errors
Checking GitLab Shell ...

GitLab Shell version >= 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ... 
5/4 ... ok
5/5 ... ok
5/6 ... ok
5/7 ... ok
5/8 ... ok
5/9 ... ok
5/10 ... repository is empty
5/11 ... ok
5/12 ... ok
5/13 ... ok
8/14 ... ok
8/15 ... ok
5/16 ... ok
5/17 ... ok
5/18 ... ok
5/19 ... ok
6/20 ... ok
6/21 ... ok
6/22 ... ok
6/23 ... repository is empty
6/24 ... ok
5/25 ... ok
5/26 ... ok
5/27 ... ok
5/28 ... ok
11/29 ... repository is empty
5/31 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Reply by email ...

IMAP server credentials are correct? ... yes
Init.d configured correctly? ... skipped (omnibus-gitlab has no init script)
MailRoom running? ... can't check because of previous errors

Checking Reply by email ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ... 
5/4 ... yes
5/5 ... yes
5/6 ... yes
5/7 ... yes
5/8 ... yes
5/9 ... yes
5/10 ... yes
5/11 ... yes
5/12 ... yes
5/13 ... yes
8/14 ... yes
8/15 ... yes
5/16 ... yes
5/17 ... yes
5/18 ... yes
5/19 ... yes
6/20 ... yes
6/21 ... yes
6/22 ... yes
6/23 ... yes
6/24 ... yes
5/25 ... yes
5/26 ... yes
5/27 ... yes
5/28 ... yes
11/29 ... yes
5/31 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.10.2)
Active users: 6

Checking GitLab ... Finished

Results of GitLab environment info

root@gitlab:~# docker exec -it gitlab gitlab-rake gitlab:env:info
I, [2017-02-11T19:34:41.602554 #6140]  INFO -- sentry: ** [Raven] Raven 2.0.2 ready to catch errors

System information
System:		
Current User:	git
Using RVM:	no
Ruby Version:	2.3.3p222
Gem Version:	2.6.6
Bundler Version:1.13.7
Rake Version:	10.5.0
Sidekiq Version:4.2.7

GitLab information
Version:	8.16.4-ee
Revision:	93daa28
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	9.2.18
URL:		https://gitlab.strikewood.com
HTTP Clone URL:	https://gitlab.strikewood.com/some-group/some-project.git
SSH Clone URL:	git@gitlab.strikewood.com:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: github

GitLab Shell
Version:	4.1.1
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
Hooks:		/opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:		/opt/gitlab/embedded/bin/git

Possible fixes

Falling back to additional email addresses on the user would be the most sensible option imo.

Edited by 🤖 GitLab Bot 🤖