Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Can't force git to use https:// instead of git:// #5257

Closed
@ceeeKay

Description

Git has a simple way to do this in the config file.

[url "https://"]
    insteadOf = git://

However npm seems to throw out the environment in lib/cache.js

var gitEnv_
function gitEnv () {
  // git responds to env vars in some weird ways in post-receive hooks
  // so don't carry those along.
  if (gitEnv_) return gitEnv_
  gitEnv_ = {}
  for (var k in process.env) {
    if (!~['GIT_PROXY_COMMAND','GIT_SSH','GIT_SSL_NO_VERIFY'].indexOf(k) && k.match(/^GIT/)) continue
    gitEnv_[k] = process.env[k]
  }
  return gitEnv_
}

So I can't inject a GIT_CONFIG or anything.

I've hand-hacked it into the addRemoteGit function in lib/cache.js with

  u = u.replace(/^git:/, "https:")

but this variable should be pulled from a config somewhere

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions