【发布时间】:2020-08-28 04:52:15
【问题描述】:
我在这里的许多其他问题中看到了使用 PyGithub 提交的主题,但没有一个对我有帮助,我不明白解决方案,我想我太新手了。
我只想将文件从我的计算机提交到我创建的测试 github 存储库。到目前为止,我正在使用 Google Collab 笔记本进行测试。
这是我的代码,问题和问题在 cmets 中:
from github import Github
user = '***'
password = '***'
g = Github(user, password)
user = g.get_user()
# created a test repository
repo = user.create_repo('test')
# problem here, ask for an argument 'sha', what is this?
tree = repo.get_git_tree(???)
file = 'content/echo.py'
# since I didn't got the tree, this also goes wrong
repo.create_git_commit('test', tree, file)
【问题讨论】:
标签: python git google-colaboratory pygithub