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 1000795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:34:09+00:00 2026-05-16T07:34:09+00:00

I have a project hosted on git.debian.org (alioth) and I’d like to configure a

  • 0

I have a project hosted on git.debian.org (alioth) and I’d like to configure a post-receive hook to update a mirror of the repository on http://gitorious.org

I suppose I’ll have to use git push --mirror gitorious

Now, I’ll need to have Alioth authorized on gitorious for the push to succeed. How do I do that?

I suppose I need to configure a user on gitorious and create a ssh key for it. And then when I do the git push in the post-receive hook, make sure this ssh key is used.

I could use a ~/.ssh/config but the problem is that many users can push on alioth, and everyone would have to log in and configure the ~/.ssh/config. Instead, I’d like to have a command line option or an environment variable to tell ssh which key to use. Can I do that?

Also, do you have other ideas how mirroring can be achieved? And, is it possible to configure it the other way around (gitorious pushing on alioth)?

  • 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-05-16T07:34:10+00:00Added an answer on May 16, 2026 at 7:34 am

    The answer is to be found in the git reference manual.

    GIT_SSH

    If this environment variable is set then git fetch and git push will use this command instead of ssh when they need to connect to a remote system. The $GIT_SSH command will be given exactly two arguments: the username@host (or just host) from the URL and the shell command to execute on that remote system.

    To pass options to the program that you want to list in GIT_SSH you will need to wrap the program and options into a shell script, then set GIT_SSH to refer to the shell script.

    Usually it is easier to configure any desired options through your personal .ssh/config file. Please consult your ssh documentation for further details.

    So, I need to write a wrapper script, I write this push-gitorious.sh script:

    #!/bin/sh
    
    
    if [ "run" != "$1" ]; then
      exec ssh -i "$GITORIOUS_IDENTITY_FILE" -o "StrictHostKeyChecking no" "$@"
    fi
    
    remote=YOUR_SSH_GITORIOUS_URL
    
    echo "Mirroring to $remote"
    
    export GITORIOUS_IDENTITY_FILE="`mktemp /tmp/tmp.XXXXXXXXXX`"
    export GIT_SSH="$0"
    
    cat >"$GITORIOUS_IDENTITY_FILE" <<EOF
    YOUR SSH PRIVATE KEY
    
    EOF
    cat >"$GITORIOUS_IDENTITY_FILE.pub" <<EOF
    YOUR SSH PUBLIC KEY
    
    EOF
    
    #echo git push --mirror "$remote"
    git push --mirror "$remote"
    
    rm -f "$GITORIOUS_IDENTITY_FILE"
    rm -f "$GITORIOUS_IDENTITY_FILE.pub"
    
    exit 0
    

    Of course, you have to fill in the private key (the public key is included in the script for reference only. You also need to fill in the gitorious URL.

    In the post-receive hook, you have to put:

    path/to/push-gitorious.sh run
    

    The run option is important, otherwise it will run ssh directly.

    Warning: no checking is done on the remote host identity. You can remove the option from the ssh command line and customize known_hosts if you want to. In this use case, I don’t think it’s important.

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

Sidebar

Related Questions

I have a project hosted on GitHub and I use Git for source versioning.
I'd like to try git (hosted on github) for a new project, but I
I have a project hosted on GitHub and I would like to work locally
I have a project which have a git submodule the project is hosted in
I have a Python Facebook project hosted on Google App Engine and use the
I have a private project, and i want it hosted on google code. this
I have a visual studio 2008 solution that includes an asp.net-hosted remoting project in
I have two different .Net projects, hosted on github. I would like to create
I have a project that I would like to start beta testing soon, it
I have a project where I would like to generate a report export in

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.