i want execute
git remote add -f origin <repo>
with dulwich. however, i couldn't find something in this direction.
Knows somebody a solution or an alternative in gitpython?
Thanks for ideas.
In Dulwich master , you can use the dulwich.porcelain.remote_add method:
from dulwich import porcelain
porcelain.remote_add('origin', 'http://github.com/git/git')
In older versions (that don't have porcelain.remote_add) you can use something like:
from dulwich.repo import Repo
c = Repo('.').get_config()
c.set(('remote "origin"', ), "url", "http://github.com/git/git")
c.write_to_path()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.