Hi! Is there any way to copy a set of files/trees from one repo to another repo via GitHub API? Not by reading the content of the file from one repo and reupload to another repo, but some other ways e.g. through the tree SHA / blob SHA in the original repo?
In theory, yes. In practice, you probably don’t want to shave that particular yak. Since there isn’t a magical “take this from here and put it there” API, you would still have to:
- Download all the appropriate blob data from the source repo
- Upload all the blob data to the destination repo by creating individual blob objects
- Create the recursive forest of tree objects necessary to reference all the blobs you just uploaded
- Then create a commit object to root the trees you just planted on the appropriate branch
Or, you could have Git do it because it knows how to manipulate its own database.