diff --git a/heptapod/gitlab/__init__.py b/heptapod/gitlab/__init__.py
index 94c6158b3bfaf8d3462f17b70fcd16a74fb521b5_aGVwdGFwb2QvZ2l0bGFiL19faW5pdF9fLnB5..f036a324a62e71e2d1099b7d3edef04216ea06d1_aGVwdGFwb2QvZ2l0bGFiL19faW5pdF9fLnB5 100644
--- a/heptapod/gitlab/__init__.py
+++ b/heptapod/gitlab/__init__.py
@@ -180,7 +180,7 @@
             return SKIP
 
         gl_id = base.get('HEPTAPOD_USERINFO_ID')
-        project_id = base.get('HEPTAPOD_PROJECT_ID')
+        gl_repo = base.get('GL_REPOSITORY')
 
         if gl_id is None:
             raise ValueError("User id not available")
@@ -184,8 +184,8 @@
 
         if gl_id is None:
             raise ValueError("User id not available")
-        if project_id is None:
-            raise ValueError("Project id not available")
+        if gl_repo is None:
+            raise ValueError("GL_REPOSITORY not available")
 
         env = dict(os.environ)
         env['HG_GIT_SYNC'] = 'yes'
@@ -195,7 +195,7 @@
         # (see gitlab_access.rb and protocol_access.rb
         # from gitlab-rails/lib/gitlab lib/gitlab)
         env['GL_PROTOCOL'] = 'web'
-        env['GL_REPOSITORY'] = 'project-' + project_id
+        env['GL_REPOSITORY'] = gl_repo
         return env
 
     def gitlab_internal_api_request(
diff --git a/heptapod/gitlab/tests/test_hooks_integration.py b/heptapod/gitlab/tests/test_hooks_integration.py
index 94c6158b3bfaf8d3462f17b70fcd16a74fb521b5_aGVwdGFwb2QvZ2l0bGFiL3Rlc3RzL3Rlc3RfaG9va3NfaW50ZWdyYXRpb24ucHk=..f036a324a62e71e2d1099b7d3edef04216ea06d1_aGVwdGFwb2QvZ2l0bGFiL3Rlc3RzL3Rlc3RfaG9va3NfaW50ZWdyYXRpb24ucHk= 100644
--- a/heptapod/gitlab/tests/test_hooks_integration.py
+++ b/heptapod/gitlab/tests/test_hooks_integration.py
@@ -83,7 +83,7 @@
 
     repo.ui.environ.update(
         HEPTAPOD_USERINFO_ID='23',
-        HEPTAPOD_PROJECT_ID='1024',
+        GL_REPOSITORY='project-1024',
     )
     changes = {
         'branch/newbr': (ZERO_SHA, "beef1234dead" + "a" * 8),
@@ -105,7 +105,7 @@
 
     repo.ui.environ.update(
         HEPTAPOD_USERINFO_ID='2',
-        HEPTAPOD_PROJECT_ID='3145926',
+        GL_REPOSITORY='project-3145926',
     )
     changes = {
         'topic/default/with-a-dash': (ZERO_SHA, "beef1234dead" + "a" * 8),
@@ -222,7 +222,7 @@
 
     repo.ui.environ.update(
         HEPTAPOD_USERINFO_ID='23',
-        HEPTAPOD_PROJECT_ID='1024',
+        GL_REPOSITORY='project-1024',
     )
 
     hook = Hook('post-receive', repo_wrapper.repo)
@@ -267,7 +267,7 @@
 
     repo.ui.environ.update(
         HEPTAPOD_USERINFO_ID='23',
-        HEPTAPOD_PROJECT_ID='1024',
+        GL_REPOSITORY='project-1024',
     )
 
     hook = Hook('pre-receive', repo_wrapper.repo)
@@ -318,7 +318,7 @@
 
     repo.ui.environ.update(
         HEPTAPOD_USERINFO_ID='23',
-        HEPTAPOD_PROJECT_ID='1024',
+        GL_REPOSITORY='project-1024',
     )
     with pytest.raises(NotImplementedError) as exc_info:
         hook(changes)
@@ -344,7 +344,7 @@
     repo = wrapper.repo
     hook = Hook('post-something', repo)
 
-    repo.ui.environ['HEPTAPOD_PROJECT_ID'] = '1024'
+    repo.ui.environ['GL_REPOSITORY'] = 'project-1024'
     with pytest.raises(ValueError) as exc_info:
         hook.environ()
     assert 'User id' in exc_info.value.args[0]
@@ -362,7 +362,7 @@
     repo.ui.environ['HEPTAPOD_USERINFO_ID'] = '3'
     with pytest.raises(ValueError) as exc_info:
         hook.environ()
-    assert 'Project id' in exc_info.value.args[0]
+    assert 'GL_REPOSITORY' in exc_info.value.args[0]
 
     # and that gets catched, does not break the process
     code, out, err = hook(dict(master=(0, 1)))
diff --git a/heptapod/tests/test_wsgi.py b/heptapod/tests/test_wsgi.py
index 94c6158b3bfaf8d3462f17b70fcd16a74fb521b5_aGVwdGFwb2QvdGVzdHMvdGVzdF93c2dpLnB5..f036a324a62e71e2d1099b7d3edef04216ea06d1_aGVwdGFwb2QvdGVzdHMvdGVzdF93c2dpLnB5 100644
--- a/heptapod/tests/test_wsgi.py
+++ b/heptapod/tests/test_wsgi.py
@@ -101,6 +101,8 @@
     # is interpreted as running from the command line
     assert 'REMOTE_USER' not in env
 
-    env = {'HTTP_X_HEPTAPOD_PROJECT_ID': '18'}
+    env = {'HTTP_X_HEPTAPOD_GL_REPOSITORY': 'wiki-18',
+           'HTTP_X_HEPTAPOD_USERINFO_USERNAME': 'testgr',
+           }
     hgs.apply_heptapod_headers(env)
     assert env.get('HEPTAPOD_PROJECT_ID') == '18'
@@ -105,5 +107,7 @@
     hgs.apply_heptapod_headers(env)
     assert env.get('HEPTAPOD_PROJECT_ID') == '18'
+    assert env.get('GL_REPOSITORY') == 'wiki-18'
+    assert env.get('HEPTAPOD_USERINFO_USERNAME') == 'testgr'
 
 
 def test_load_repo(tmpdir):
diff --git a/heptapod/wsgi.py b/heptapod/wsgi.py
index 94c6158b3bfaf8d3462f17b70fcd16a74fb521b5_aGVwdGFwb2Qvd3NnaS5weQ==..f036a324a62e71e2d1099b7d3edef04216ea06d1_aGVwdGFwb2Qvd3NnaS5weQ== 100644
--- a/heptapod/wsgi.py
+++ b/heptapod/wsgi.py
@@ -60,7 +60,6 @@
     'USERINFO_USERNAME',
     'USERINFO_NAME',
     'USERINFO_EMAIL',
-    'PROJECT_ID',
     'PROJECT_PATH',
     'PROJECT_NAMESPACE_FULL_PATH',
     )
@@ -106,6 +105,14 @@
             hepta_val = environ.pop('HTTP_X_HEPTAPOD_' + hepta_key, None)
             if hepta_val is not None:
                 environ['HEPTAPOD_' + hepta_key] = hepta_val
+        # special case for GL_REPOSITORY, forwarded as such to match
+        # system environment variable name in subprocess calls
+        gl_repo = environ.pop('HTTP_X_HEPTAPOD_GL_REPOSITORY', None)
+        if gl_repo is not None:
+            environ['GL_REPOSITORY'] = gl_repo
+            split_repo = gl_repo.split('-', 1)
+            if len(split_repo) == 2:
+                environ['HEPTAPOD_PROJECT_ID'] = split_repo[1]
 
     def __call__(self, env, respond):
         baseurl = self.ui.config('web', 'baseurl')