简体   繁体   中英

Github REST API git clone

Is there a method to directly do cloning via the REST v3 Github API? Is the best way to create a new repo via the API, get the content of the one you want, and do a PUT request to the new repo with that content? Does that method even work?

I want to clone a GitHub repository into an arbitrarily named repository on my own account without support from the git CLI or GitHub UI (ie using GitHub Actions programmatically to automatically provision the repository). What are some thoughts on the best way to do this?

tl;dr There isn't a way to "clone" via API's.

I'm also looking to do something similar, here are some workarounds I've found:

  1. You can hit the repo api and get the clone url and manually clone. You won't be able to clone via the API, however.

  2. Use the content api . This will get you a link to download each file, and a url to get the tree of each folder. You'll have to traverse this and manually download each file. This might be optimal for individual files, not the whole repo.

  3. You can also download the entire repository . This might be optimal for getting the entire repo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM