git/list[1] front-page[2] threads[3] people[4] search[5] about
 

GIT_SSH and mirror not working with git 2.30.1

From
LCLamborn, Peter Craig <plamborn@lanl.gov>
Date
Mar 16, 2021, 18:53 UTC
Message-ID
<e39d23615e084671965fc96174ac881e@lanl.gov>
We have some machines behind firewalls and gateways that cannot access git repos directly.  We have been using GIT_SSH and mirror to push and pull git request through a less restricted machine.  This has been working for a while, specifically both git 2.24.1 and git 2.28 can handle the method we have been doing. 
When you try the same thing with git 2.30.1, the "git push" commands still succeed.  But "git pull" returns this:

$ git pull <mirror name> hint: Pulling without specifying how to reconcile divergent branches is hint: discouraged. You can squelch this message by running one of the following hint: commands sometime before your next pull: hint: hint: git config pull.rebase false # merge (the default strategy) hint: git config pull.rebase true # rebase hint: git config pull.ff only # fast-forward only hint: hint: You can replace "git config" with "git config --global" to set a default hint: preference for all repositories. You can also pass --rebase, --no-rebase, hint: or --ff-only on the command line to override the configured default per hint: invocation.

ssh: connect to host <destination machine> port 22: Operation timed out fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists. $

Does git 2.30.1 change something about mirrors and/or GIT_SSH that would cause git pulls to fail?  Do we need to adjust our current process?
Our method:

destination_machine$ mkdir <DZPATH> destination_machine$ cd <DZPATH> destination_machine$ git --bare init

...
workstation$ cat ssh-hop.sh
#!/bin/bash
  
MACHINE_REGEXP="<...>"
  
if [[ $1 =~ $MACHINE_REGEXP ]]; then
  
  exec ssh <gateway> ssh "$@"
  
else
  exec ssh "$@"
fi

workstation$ chmod u+x ssh-hop.sh workstation$ export GIT_SSH=<path to>/ssh-hop.sh workstation$ cd <git repo> workstation$ git remote add --mirror <mirror name> <destination_machine>:<DZPATH> workstation$ git push <mirror name> workstation$ git pull <mirror name>

Thank you,
Peter
Next: Andreas Schwab
Message 1 of 3 in “GIT_SSH and mirror not working with git 2.30.1”
  1. Lamborn, Peter CraigMar 16, 2021
  2. Andreas SchwabMar 16, 2021
  3. Jeff KingMar 16, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.