Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Your access to this site has been restricted in Go Http client

I'm running into an issue when using Go's http client to download a zip or tar.gz file from Github. I get a 403 with the message "Your access to this site has been restricted".

Curl works fine though.

I am running this in an EC2 instance on AWS in the us-west-2 region. In particular,

Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-0807918df10edc141 (64-bit x86) / ami-0c75fb2e6a6be38f6 (64-bit Arm)

Info

  • Go: go1.15.linux-amd64 (tried it on 14 too)
  • AWS - Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-0807918df10edc141 (64-bit x86) / ami-0c75fb2e6a6be38f6 (64-bit Arm)
  • Endpoint: https://github.com/kubeflow/manifests/archive/v1.0.2.tar.gz (I've tried it with others too, none work)

Sample code to reproduce:

package main

import (
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    endpoint := "https://github.com/kubeflow/manifests/archive/v1.0.2.tar.gz"

    // or https://api.github.com/repos/kubeflow/manifests/zipball/v0.12.0

    // Get the data
    resp, err := http.Get(endpoint)
    if err != nil {
        fmt.Printf("[error] %v", err)
        return
    }
    defer resp.Body.Close()

    respData, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        fmt.Printf("[error] %v", err)
        return
    }

    // Returns a 403 and html error page
    fmt.Printf("Resp:\n%v\n", string(respData))
}

Note: the above works fine on my local machine, it just seems to stop in the aws instance.

Thanks!

like image 679
Vafilor Avatar asked Oct 16 '25 15:10

Vafilor


1 Answers

I had a similar problem: "Access to this site has been restricted..."

I solved this by updating my IDE (IntelliJ IDEA) and git version. You can do this all directly in IntelliJ IDEA.

like image 131
Yra Sabat Avatar answered Oct 19 '25 13:10

Yra Sabat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!