Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8487223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:10:37+00:00 2026-06-10T21:10:37+00:00

Experimenting with git, I’ve setup Gitlab for a self hosted repository and it looks

  • 0

Experimenting with git, I’ve setup Gitlab for a self hosted repository and it looks great.

The one thing bugging me is that it appears anyone can make commits as anyone else (ie: spoof a commit).

ie: I have my users setup in Gitlab with public key access

  • User1
  • User2

Now only those users may push – using their private SSH keys – but it seems there is nothing stopping User2 tweaking their gitconfig to commit under the name of User1 and pushing that up?

The history in gitlab and git -show shows the committer as whatever the User1’s gitconfig text was. I want Gitlab to stamp the username associated with the pushing ssh key into the history instead so I know whose ssh key was used to push.

The scenario is the repo would be used in a team environment and it just seems prudent to not allow spoofed commits.

I’ve done some reading and understand that typically one might change the workflow to have a blessed repository and only have trusted committers that can push to that – but at this stage while learning git I want to stay in a more centralised/SVN type workflow.

Is this possible using hooks?

There is a similar question answered for gitosis but even that appears to only enforce the committer is from a range of users which doesn’t stop User1 spoofing as User2 – as far as I can tell.

PS: Maybe I am asking the wrong question – is there a way in gitlab to discover which ssh key (and therefore real user) was used to push code into the repo? It doesn’t appear so from what I can find.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:10:39+00:00Added an answer on June 10, 2026 at 9:10 pm

    Update 2015

    As this thread mention, GitLab Enterprise has among its git hooks associated to a project a way to control emails:

    Go to project settings -> git hooks and check validation of author email.

    Any email that doesn’t match a known user is rejected.


    Original answer (2012)

    A partial way to achieve user id control is to make gitolite (which gitlab relies on) reject the push if at least one of the pushed commits isn’t committed by the one pushing it.

    When you push, you are authenticated (either based on the name of the public key registered by Gitolite, or by another way like an LDAP connection).
    You can add a pre-receive hook which will check all the new commits, and look for at least one committed by the right name (ie the id of the user pushing said commits).
    See this pre-receive hook as an example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm experimenting with some githooks , so I have setup a local bare repository
I'm trying to use a local Git repository (i.e. not hosted on GitHub at
At our firm, we're experimenting with moving from svn to git. We want to
When experimenting with (embedded) Apache Derby DB, I noticed that a fresh database, with
I'm experimenting with Git... I've found Beanstalkapp suits my needs. I've created individual repositories
Recently, I've started experimenting with Mercurial, due to the fact that it always attracted
Just experimenting and learning, and I know how to create a shared dictionary that
While experimenting with Git, I changed a file's content from 1 to 100 ,
I'm experimenting with git-svn , and am trying to come up with a relatively
Experimenting with Swing, I learnt that there are two ways of using JOptionPane and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.