DEV Community

Frastyawan Nym
Frastyawan Nym

Posted on • Updated on

Access your Golang Private Repository

  1. Add your ssh to you git host

  2. Update your GOPRIVATE
    go env -w GOPRIVATE="github.com/<OrgNameHere>/*"

  3. Update your gitconfig. This example for bitbucket:
    git config --global url."git@bitbucket.org:".insteadOf "https://bitbucket.org/"

  4. Add your ssh key with ssh-agent.You have to apply

    eval "$(ssh-agent -s)"
    > Agent pid 5867
    ssh-add <private-ssh-key-file-name> // eg. id_rsa (not .pub)
    > Enter passphrase for /home/you/.ssh/id_rsa: [] Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)
    
  5. Try run go mod tidy on your project

Top comments (0)