I'm trying to use Go-Github to create a text file and push it into a remote branch but I'm totally confused on how to do it.
I'm able to get a listing of repositories with my client org
repos, _, err := client.Repositories.ListByOrg("MyOrg", nil)
I'm able to use that and get a remote branch
branch, resp, err := client.Repositories.GetBranch("MyOrg", "MyRepository", "MyBranch")
but for the life of me I'm unable to figure out how to commit a file (or files) in my local branch and push the commit to the remote branch.
Thanks for any help that anyone can give.
You would need a different library to (in your local repo):
See "git library for Go", like the libgit2/git2go project (and its push test).
push, err := remote.NewPush()
checkFatal(t, err)
err = push.AddRefspec("refs/heads/master")
checkFatal(t, err)
err = push.Finish()
checkFatal(t, err)