Git: how can a team pull and push to the repo from the test server

I guess this is a best-practice question:

We have a test server, a git repository and several workstations.
When we do browser tests we work directly on the test server.
So whoever does the browser tests, he/she must be able to commit changes from the test server to the repository.
Problem is: the git remote (on the test server) specifies a single user for pulling/pushing from/to the repo (in .git/config). Although each team member has a ssh user for the repo.

  • Bower install slow when running from teamcity
  • Git no such file or directory
  • where is the bugtracker of Git?
  • Can I bind 2 (or more) git commits and create dependency between them?
  • Git Bash hangs on CTRL + I
  • How can I pull twice in the git?
  • Question is: how can each user make use of his/her own ssh access for git pulling/pushing?

  • How to do a dotCloud pull?
  • Using Rails + Capistrano with Github and multiple branches
  • how to get files out of the git tab if rstudio
  • Git commit user is different than git push user
  • If I create a branch in Git, is it ok to merge the parent branch back into my working branch?
  • What is the Mercurial equivalent to `git log --graph --decorate --oneline --all`?
  • 2 Solutions collect form web for “Git: how can a team pull and push to the repo from the test server”

    Try specifying git repo url without username in the clone on the test server (you may change it in config or just clone anew). It will make git use default ssh user name for the host in that url.

    Depending on your setup, you may need to additionally modify ~/.ssh/config for each user.

    Update

    If everyone logs in with the same single user on your test server (a setup that I would not recommend), then it looks like that you have to hack one way or another.

    One possible way to do that is this (I did not try it):

    If you worry about user.name and user.email, allow test server user to access master git repo and force each user to set GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL (and, maybe, some others) environment variables after login.

    It would make sense to do that in some script, just not in .bashrc or similar, for obvious reasons.

    To protect yourself from forgetful users, you may want to set up pre-commit hook in git clone where users do their commits to check if the script was called (via environment variable, for example). Alternatively, set up post-receive script on the master git repo, and check there that user credentials in the pushed commits are not that of test server user. In that case users would have to rewrite history to fix commit authors.

    If that is not enough, please share more details.

    You can specify the author when committing . Example git commit --author="Author Name <email@address.com>"

    A better way, force users to supply an author. In your ~/.bashrc or ~/.profile create the following function –

    function gitco() { /usr/local/git/bin/git commit --author="$1"; }
    

    When users commit ask them to run gitco <email address>. Without the email address, gitco will fail.

    Example:

    gitco me@me.abcdf
    
    Git Baby is a git and github fan, let's start git clone.