使用 github API,创建 git 拉取请求而不签出代码

using the github API, Create git pull request without checking out the code

如何使用 github api 为我尚未签出的项目创建 github 拉取请求。我想自动对存储库进行简单的更改,我不需要先签出。我只是想从 raw.githubusercontent.com 中拉取一个文件,修改它并创建上述拉取请求。

EDIT github Web 用户界面允许通过在后台克隆和创建拉取请求来编辑外部文件。

I haven't checked out using the github api.

你至少应该先分叉回购协议(见GitHub API create a fork

然后是“Create a Pull Request" supposes you have pushed a commit to a dedicated branch (API "Create a commit" first, which supposes to create a tree first, based on creating a blob).

对于所有这些操作,我建议使用 GitHub API 的包装器,例如 go-github,这可能会使所有系列操作更容易链接。

你必须检查过它,但你可以使用脚本命令行来完成它。

拉取请求要求将特定的 git 提交合并到主存储库中,而不是对文件进行一组编辑。如果您拥有 github 存储库的可写副本,则只能合并提交,您只能通过克隆或分叉项目来获得它。

api支持远程克隆

https://developer.github.com/v3/repos/forks/#create-a-fork