我玩JGit,我可以成功地从某个存储库(git remote rm origin
)中删除一个遥控器,我该怎么做git remote add origin http://github.com/user/repo
?
要删除我执行以下操作:
StoredConfig config = git.getRepository().getConfig();
config.unsetSection("remote", "origin");
config.save();
Run Code Online (Sandbox Code Playgroud)
但是没有像这样的选择#setSection(String, String)
.
提前致谢.
caa*_*os0 33
管理它以这种方式工作:
Git git = new Git(localRepository);
StoredConfig config = git.getRepository().getConfig();
config.setString("remote", "origin", "url", "http://github.com/user/repo");
config.save();
Run Code Online (Sandbox Code Playgroud)
而且它显然像老板一样.