We use AWS code deploy to deploy the Github projects to Ec2 instances every time it deploys it asks for Github username and password to download the repository. Found following ways to solve this
- Supply Uname & Pwd (not preferred)
- Setup SSH Key (not possible as the instance keeps changing ip)
- Oauth token
Setting up Oauth for PHP repository was done by adding it in composer auth.json .composer/auth.json.
{
"http-basic": {},
"github-oauth": {"github.com": "xyzasasasauhu"}
}
But couldn't find a way to do this for Golang project. Typically we want to achieve go get https://github.com/username/reponame without supplying the credentials explicitly.