如何使用ngit(或jgit)将现有存储库上的跟踪设置为远程存储库? [英] How to set tracking on an existing repo to a remote repo with ngit (or jgit)?
本文介绍了如何使用ngit(或jgit)将现有存储库上的跟踪设置为远程存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用基于gui的帮助程序实用程序,
I am working on a gui based helper utility that will:
- 初始化本地存储库,初始化(裸露)远程存储库
- 基于项目类型添加.gitignore
- 在本地提交所有文件
- 向其中添加远程仓库本地配置
- 将主服务器推送到远程仓库
- 创建一个develop分支并将其推送到主服务器
- Init a local repo, Init (bare) a remote repo
- Add .gitignore based on a project type
- Commit all the files locally
- Add a remote repo to the local config
- Push master to the remote repo
- Create a develop branch and push it to master
所有这些都是通过使用ngit(.git的.NET端口)安装git来完成的。
All this is done without git installed by using ngit (.NET port of jgit).
但是我可以t弄清楚如何设置跟踪以仅使用ngit 跟踪母版到原始/母版并发展到原始/开发。
But I can't figure out how to setup tracking to track master to origin/master and develop to origin/develop using just ngit.
我可以做到
git branch --set-upstream master origin/master
但是,我希望避免依赖本地git安装。
However, I was hoping to avoid the dependency of a local git install.
推荐答案
以下是与-setup-upstream $ c $相对应的Java代码段c>
git分支
的选项:
Git git = Git.open(new File("/home/repos/myrepo"));
CreateBranchCommand create = git.branchCreate();
create.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);
create.setName("develop");
create.setStartPoint("origin/develop");
create.call();
这篇关于如何使用ngit(或jgit)将现有存储库上的跟踪设置为远程存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文