Say I have two repos, repo1 and repo2.
Let's say repo1 has the following directory structure:
repo1
|--someFolder
|-- file1.txt
|-- file2.jpg
And let's say repo2 is empty. My goal is to use the GitHub Trees API to copy all of someFolder into repo2. But I've run into the following problems:
When I use the following parameters in my HTTP POST request to the url
https://api.github.com/repos/my-username/repo2/git/treeswith the following parameters{'base_tree': repo2_base_tree_sha, 'tree': [ //Specially formatted tree from repo1 {'mode': u'100644', 'path': u'.travis.yml', 'sha': u'559d004c3af59b3bd8dcc486d5d2b5f91ab4f85d', 'type': u'blob'}, {'mode': u'100644', 'path': u'README.md', 'sha': u'11e4f5fa0b929ff6bccd8f5bcd99cbdbd845d69a', 'type': u'blob'} ] }I get a 422 response with a message sayingtree.sha 559d004c3af59b3bd8dcc486d5d2b5f91ab4f85d is not a valid blob. This leads me to believe that one cannot simply construct a new tree forrepo2using a tree fromrepo1, so how is one to take a tree from another repository and add it to another?Secondly I can successfully modify
repo1's base tree using the same parameters above except thatbase_treeisrepo1's base_tree SHA. However, when I visitrepo1those changes aren't reflected, not sure as to why.