Github fix permission denied error

when using go mod to get private dependencies.

Donald Le

--

Example error

go: github.com/account/project-utils@v0.0.0-20201015040921-5f23d1a17a73: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /home/cuongld/go/pkg/mod/cache/vcs/asshfsfsd: exit status 128:
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

You need to add ssh public key to your github account.

In order to add ssh public key, all you need to do is navigate to https://github.com/settings/keys and add it.

Then you can

go get

to download the needed dependencies.

~~ Happy coding guys~~

--

--

Donald Le

A passionate automation engineer who strongly believes in “A man can do anything he wants if he puts in the work”.