私はローカルのgitリポジトリを持っています。私はgitpythonライブラリを使用してローカルのリポジトリをコミットするためにPythonを使用しています。コミットをgithubにプッシュしたいgitpythonや他のライブラリを使ってどうすればいいですか? 私はオンラインで見ましたが、解決策はありませんでした。誰もがこれで私を助けることができます。予め おかげpythonを使ったgit push
-1
A
答えて
1
from git import Repo,remote
rw_dir = 'path/to/your/local/repo'
repo = Repo(rw_dir)
'''Enter code to commit the repository here.
After commit run the following code to push the commit to remote repo.
I am pushing to master branch here'''
origin = repo.remote(name='origin')
origin.push()
+3
このコードスニペットは、([説明を含む]問題を解決できるが、HTTP ://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers)は本当にあなたの投稿の質を向上させるのに役立ちます。将来読者の質問に答えていることを覚えておいてください。そうした人々はあなたのコード提案の理由を知らないかもしれません。 [レビューから](https://stackoverflow.com/review/low-quality-posts/15052961) – Ferrybig
関連する問題
- 1. git push origin masterとgit pushの違い
- 2. Git pushコマンド
- 3. strange git pushエラー
- 4. Git push upstream
- 5. Git Push Not Working
- 6. git post-push hook?
- 7. git push to branch
- 8. Heroku - git push
- 9. TFS 2015ビルドがGIT PUSHで固まった
- 10. Git push to remote directory?
- 11. 'git push origin master'フリーズ
- 12. "git push origin master"フリーズ
- 13. Bitbucket git push as user
- 14. Heroku-Git push without building
- 15. Git push to live ssh
- 16. "git push":スラッグコンパイルがハングアップ
- 17. git push originとgit push origin masterの違い
- 18. regluar 'git push'出力からのHeroku 'git push'出力の解読
- 19. ポート転送(SSHトンネル)を使用したgit push
- 20. Git Push中の壊れたパイプ
- 21. リモートリポジトリへのgit pushをgit initで開始しました
- 22. git rebase masterが誤ってgit push originの代わりにgit pullを実行した/ your_branch -f
- 23. xcode4 git pushエラー403 git repoにアクセス中
- 24. Git Pushを使ってビルドをトリガすることはできますか?
- 25. Git Push APIを使用してGit Pushを制限するにはどうすればよいですか?
- 26. git push git filter-branchが拒否されました
- 27. ローカルマシンから "git push"するたびにサーバー上の "Git pull"
- 28. git pushコマンドの確認
- 29. git pushでの自動デプロイ
- 30. git push heroku masterのエラー
https://gitpython.readthedocs.io/en/stable/reference.html#git.remote.PushInfo – hjpotter92