由于公司政策,我们无法直接从公司网络访问GitHub,因此必须通过公司镜像完成。当我们需要运行需要从GitHub下载依赖项的代码时,这是非常痛苦的。
现在,我必须进入代码文件,并逐行替换从“ github.com/username/repo_name”到“ company_mirror.com/username/repo_name”的每个URL,其中company_mirror.com是我们的公司镜像。
只是想知道有什么方法可以更改某个地方的设置,以便每当尝试访问github.com时,它都会访问company_mirror.com?这可以通过在BashRC中添加几行来实现吗?
系统:Ubuntu 20.04
Due to company policy we cannot access GitHub directly from company network, it has to be done via a company mirror. This is very painful when we need to run codes that needs to download dependencies from GitHub.
Right now I have to go into the code files and replace line by line for every URL from "github.com/username/repo_name" to "company_mirror.com/username/repo_name" where company_mirror.com is our company mirror.
Just wondering is there a way I can change the setting somewhere so that whenever something tries to access github.com it will access company_mirror.com instead? Could this be achieved by adding a few lines in bashrc?
System: Ubuntu 20.04
发布评论
评论(1)
您应该能够添加一个或多个 对您的配置规则:
在此示例中,类似的事情应该起作用:
最终结果将是您的
〜/.gitConfig
中的类似结果:You should be able to add one or more
insteadOf
rules to your configuration:In this example, something like this should work:
And the end result will be something like this in your
~/.gitconfig
: