[英]Fork repository on github through GitHub REST API
How could I make request through GitHub REST API? 我如何通过GitHub REST API发出请求? I have id, generated secret and toket with access to repository, but HOW to make request (correct url or so on) to Fork selected repository?
我有ID,生成的机密信息和可以访问存储库的令牌,但是如何向Fork选择的存储库发出请求(正确的url等)?
What I did: 我做了什么:
const forkRepository = await fetch("https://api.github.com/repos/dd/controlp5/forks", {
method: 'POST',
headers: {
'Authorization': 2733364296c2b40e2c4088cade1ffc9cc758dbf8,
'Content-Type': 'application/json'
}
});
return forkRepository;
And I took this 我拿了这个
Response {type: "cors", url: "https://api.github.com/repos/dd/controlp5/forks", redirected: false, status: 401, ok: false, …}
body: ReadableStream
locked: (...)
__proto__: Object
bodyUsed: false
headers: Headers
__proto__: Headers
ok: false
redirected: false
status: 401
statusText: "Unauthorized"
type: "cors"
url: "https://api.github.com/repos/dd/controlp5/forks"
__proto__: Response
And the last what i need understand, what token I need to use and how could I take it? 最后我需要了解的是什么,我需要使用什么令牌以及如何使用它? Because my acces token doesn't work to fork.
因为我的acces令牌无法进行分叉。
URI to fork a repository: 派生存储库的URI:
POST https://api.github.com/repos/:owner/:repo/forks
:owner
replaces the owner and :repo
the Repository name. :owner
替换所有者,而:repo
替换存储库名称。
For example, here's a repository forking germanysources/FOSSwareSearch
: 例如,这是一个分叉
germanysources/FOSSwareSearch
的存储库:
POST https://api.github.com/repos/germanysources/FOSSwareSearch/forks
The github documentation can be found at: https://developer.github.com/v3/repos/forks/ 可以在以下位置找到github文档: https : //developer.github.com/v3/repos/forks/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.