python - 并非所有文件都使用 GitPython 传输到 Github
问题描述
我在 python 上使用以下代码推送到 git(忽略 async 和 ctx 部分):
async def gitpush(self, ctx):
try:
repo = Repo(os.getcwd())
repo.git.add(update=True)
repo.index.commit("Committed")
origin = repo.remote(name='origin')
origin.push()
await ctx.send("Git pushed!")
except:
await ctx.send("Some error occured while pushing..")
和
async def gitpull(self, ctx):
g = git.cmd.Git(os.getcwd())
g.pull()
await ctx.send("Git pulled!")
但是,如果我这样做了,我添加/删除的文件就不会再出现在 repo 上。有没有办法将文件夹中的所有文件添加/推送到 github?
谢谢!
解决方案
而不是update=True
,放A=True
。
推荐阅读
- javascript - 复选框值返回并添加到字符串
- python - SOAP 调用响应只得到最后一个结果 - Python
- javascript - TypeError: firebase.analytics is not a function when mocking with jest
- html - 如何将视频插入到 HTML 文本中?
- java - JSF 列表取决于返回 nullPointer 的选定值
- java - 使用 BufferReader '\n' 读取后不会被接受为换行符,如何解决这个问题?
- python - 新项目 :: adv. 通讯录,但我遇到了一些问题
- java - SOAP WsSecurity 数字签名使用 CXF 和 WSS4J for X509Certificate
- javascript - 将 React Navigation v5 身份验证错误传递回注册/登录屏幕
- python - Gensim 模型:类“FileNotFoundError”