【问题标题】:How do I get started integrating Git with Android Studio?如何开始将 Git 与 Android Studio 集成?
【发布时间】:2017-03-23 23:22:19
【问题描述】:

我已经在我的局域网上设置了一个 Git 服务器(Mac 的简单 Git 服务器)。我正在使用 LAN 上的其他机器进行 Android Studio 开发。现在怎么办?在 Android Studio 的 VCS 菜单上,“Integrate Project...”显示为灰色。

如果我理解的话,我必须首先在工作站上创建一个本地存储库,然后以某种方式将我的项目文件放入其中并将其复制到服务器上。也想不通怎么办。如果您已经设置并填充了远程存储库,这似乎很有用,但我无法解决问题。

另外:是否建议每个项目都有一个单独的存储库?

【问题讨论】:

    标签: android git android-studio intellij-idea


    【解决方案1】:

    如果您已经在线设置了 git 存储库。首先,您在要提交到 git 的目录中执行 git init,然后您需要通过对所有文件执行 git add . 或对特定文件执行 git add <your file> 来提交要添加的文件。之后,您需要通过 git commit -m "your message here " 提交文件,然后执行:

    git remote add origin <remote repository URL> //get this from git assuming your have already set up the git repo
    # Sets the new remote
    git remote -v
    # Verifies the new remote URL
    Push the changes in your local repository to GitHub.
    
    git push -u origin master
    # Pushes the changes in your local repository up to the remote repository you specified as the origin
    

    所有这些信息都来自这里的 git 文档: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

    是的,通常您希望每个项目都有一个单独的存储库。也有例外,但就我个人而言,我还没有找到合适的。

    【讨论】:

    • 谢谢。我猜当 IntelliJ 说他们已经“集成”了 git 时,他们有点夸大了。
    • 不客气。希望能帮助到你。如果您喜欢答案,请随时投票:)
    • @RobertLewis 他们有集成,但您负责在您的机器上本地设置存储库。一旦设置完成,IntelliJ 就能够与 VCS 交互。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多