Tuesday, August 06, 2019

Tip: How to Git Push Passwordless via SSH for Multiple Internal and External Repositories

Requirement:

   Sometimes we have projects. We need to git commit changes for multiple git repositories. Some repositories are internal, some are external. We would like to setup passwordless for them as well

Solution:


  • Setup ssh key for all the git repositories , thus we can git commit passwordless . Refer github doc
  • Setup ssh config to use proxy to ssh external git repositories if we are behind proxy in intranet,  ie github.com
  • vi .ssh/config , example below

Host=github.com
ProxyCommand=socat - PROXY:your.proxy.ip:%h:%p,proxyport=3128,proxyauth=user:pwd

  • git remote -v
  • git remote set-url --add --push origin git+ssh://original/repo.git
  • git remote set-url --add --push origin git+ssh://another/repo.git



No comments: