JGitで遊んでいたところ、一部のリポジトリ(git remote rm origin
)からリモートを正常に削除できました。どうすればgit remote add origin http://github.com/user/repo
を行うことができますか?JGit経由でリモートを追加する
StoredConfig config = git.getRepository().getConfig();
config.unsetSection("remote", "origin");
config.save();
しかし#setSection(String, String)
のようなオプションはありませんがあります:私は、次の手順を実行を削除するには
。
ありがとうございます。
Git git = new Git(localRepository);
StoredConfig config = git.getRepository().getConfig();
config.setString("remote", "origin", "url", "http://github.com/user/repo");
config.save();
をそしてaparentlyそれが上司のように動作します:
ここにgitとは何ですか? –
'Git'のインスタンスです。 – caarlos0