thurt
thurt

Reputation: 912

How to setup Gogs as a local github cache for "go get"

I have a Gogs server setup and running with PostgreSQL. I have also mirrored a public repo from github by using the Gogs web interface.

Now I'm wondering can I make the commandline go get use the Gogs server as a proxy for getting packages? ie. I want the command like https_proxy=http://gogs_server:3000 go get -u github.com/user/repo to download the mirror repo from the local Gogs server instead of actually going out to github.com to download it.

Upvotes: 1

Views: 526

Answers (1)

wgoodall01
wgoodall01

Reputation: 1888

To do that, you would most likely have to create some kind of customized HTTP proxy to rewrite GitHub URLs to point to your Gogs instance, and then stick that in between go get and the Internet.

However, if you're just looking to cache packages locally for better performance (or better reliability), it's recommended to keep them in the vendor directory. That way, they can't unexpectedly vanish, and are kept in source control with the rest of your code.

Upvotes: 2

Related Questions