I'm working in an application that generates files, and I would like to push those files to a github repo. Is that possible to do from within the app?
1条回答 默认 最新
- dongzhong7299 2019-04-26 16:06关注
Try the package go-git. It allows you to perform git clone/commit/push operations. It can clone a tree in-memory too without requiring disk access.
From the the commit example is a sample add/commit:
_, err = w.Add("example-git-file") CheckIfError(err) commit, err := w.Commit("example go-git commit", &git.CommitOptions{ Author: &object.Signature{ Name: "John Doe", Email: "john@doe.org", When: time.Now(), }, })
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报