简体   繁体   English

Eclipse + Egit - 将新的Java项目添加到远程存储库

[英]Eclipse + Egit - adding a new Java project to a remote repository

I have a Java project in Eclipse that I maintain using a local git repository (The repository has only that one project). 我在Eclipse中有一个Java项目,我使用本地git存储库维护(存储库只有一个项目)。

I've been asked to push this project to a remote git repository. 我被要求将此项目推送到远程git存储库。 This repository already has other projects in it (and apparently the plan is to maintain all my team's projects in this repository). 这个存储库中已经有其他项目(显然该计划是在我的存储库中维护我所有团队的项目)。

How would I go about doing this using Eclipse and Egit? 我将如何使用Eclipse和Egit进行此操作? (Alternatively, I wouldn't mind doing this on the command line as well). (或者,我也不介意在命令行上执行此操作)。

When I tried the "normal" procedure for pushing a project using Egit (Right-click project -> Team -> Remote -> Push) I get an error "master: master [rejected - non-fast-forward]. 当我尝试使用Egit(右键单击项目 - >团队 - >远程 - >推送)推送项目的“正常”过程时,我收到错误“master:master [被拒绝 - 非快进]。

Try doing a git pull to sync up with the remote repository, then you should be able to push to it. 尝试执行git pull以与远程存储库同步,然后您应该能够推送它。 The non-fast-forward most likely means you have an old copy checked out. 非快进最有可能意味着您已签出旧版本。

do the following and replace the <tags> with your data 执行以下操作并将<tags>替换为您的数据

git clone <git_url> <foldername>
cd <foldername>
git checkout -b <new_project_name>
<copy all your files to the folder>
git push origin <new_project_name>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM