I am running the following as I could not replicate an issue locally on Macbook with what was going on in CircleCI:
func (s *Service) Checkout(ctx context.Context, sshAuthSock *dagger.Socket) {
git := dag.Git("git@github.com:company/my-repo.git", dagger.GitOpts{
SSHAuthSocket: sshAuthSock,
})
container, err := dag.Container().
From("alpine").
WithUnixSocket("/ssh-agent/agent.sock", sshAuthSock).
WithEnvVariable("SSH_AUTH_SOCK", "/ssh-agent/agent.sock").
WithExec([]string{"apk", "add", "curl", "jq", "aws-cli", "git", "openssh-client"}).
WithDirectory("/my-repo", git.Head().Tree()). // Also tried this with `git.Branch("main").Tree()
WithExec([]string{"sh", "-c", "git checkout main"}).
Terminal().Sync(ctx)
}
In the terminal if I try and checkout main I am presented with the following:
warning: refname 'main' is ambiguous.
Switched to branch 'main'
And this seems to be caused by a tag being created called main. This tag does not exist and this issue is not happening when running the same locally. I have tried to use the machine executor within circleci but still got the same issue