【问题标题】:How should I add my intelliJ project to an already existing Github repository?我应该如何将我的 intelliJ 项目添加到已经存在的 Github 存储库中?
【发布时间】:2017-04-06 02:54:52
【问题描述】:

我已经有一个 Github 存储库,但我需要将我的实际项目添加到存储库中。我应该如何用 IntelliJ 做到这一点?该项目当然应该是版本控制的。

【问题讨论】:

    标签: java github intellij-idea


    【解决方案1】:

    一旦在项目根目录中找到.git 目录,IntelliJ 就会自动发现并“添加”您的 git 存储库。您必须运行的步骤取决于您是否已经为您的项目初始化了一个 Git 存储库。如果没有,首先打开一个终端(例如,通过按 ALT+F12 在 IntelliJ 中打开一个终端窗口)并运行

    git init
    

    之后(或者如果您的项目中已经有一个 git 存储库),您可以将此存储库“连接”到您在 Github 上的项目

    git remote add origin GIT_URL_ON_GITHUB
    

    IntelliJ 将“找到”您的存储库并提供 git 支持。

    【讨论】:

      【解决方案2】:

      我不知道您对 IDEA 热键有多熟悉,因此使用顶部导航栏的说明:VCS -> Enable Version Control Integration -> Select your version control system (Git in your case) -> Wait for IDEA to update project -> Your project hierarchy now shows all files in brown color -> Select the files you want to commit -> Right click and select Git-Add -> In the bottom navigation bar you should also see "9: Version Control" -> Click on this button -> The window with uncommited changes appears and recently added files are green-colored -> Select the files you want to commit -> Right click on the files -> Select "Commit Changes" from the popup menu -> Specify commit message -> Hover over the "Commit" button -> Press "Commit and Push" -> In the dialog you can specify the master branch of your origin repo on Github -> Press Push after that -> You're done

      如果我错过了什么,请随时问我。出去。

      【讨论】:

        【解决方案3】:

        您可以通过以下步骤将项目的本地目录初始化为 Git 存储库:https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

        然后,如果您有 IntelliJ 的 Git 插件,请转到版本控制,提交更改,然后您可以推送。

        【讨论】:

          【解决方案4】:

          VCS -> Git -> 遥控器... this is how it looks like

          【讨论】:

            猜你喜欢
            • 2013-05-29
            • 2020-01-09
            • 2020-05-12
            • 2013-07-01
            • 2012-09-23
            • 2022-01-14
            • 2016-02-04
            • 2022-09-26
            • 1970-01-01
            相关资源
            最近更新 更多