0

実行したい

git remote add -f origin <repo>

ダルウィッチ付き。しかし、私はこの方向に何かを見つけることができませんでした。

誰かが gitpython の解決策または代替案を知っていますか?

アイデアをありがとう。

4

1 に答える 1

1

Dulwich masterでは、dulwich.porcelain.remote_add メソッドを使用できます。

from dulwich import porcelain
porcelain.remote_add('origin', 'http://github.com/git/git')

古いバージョン (porcelain.remote_add がない) では、次のようなものを使用できます。

from dulwich.repo import Repo
c = Repo('.').get_config()
c.set(('remote "origin"', ), "url", "http://github.com/git/git") 
c.write_to_path()
于 2016-07-05T23:42:50.590 に答える