使用 android studio 将我的项目连接到 gitlab

Connect my project to gitlab with android studio

我的朋友在 gitlab 上创建了一个项目,当我登录 gitlab 时,我查看项目 xxxxx/project 如果我点击它,我进入项目并且我可以 select link ssh 或 https。 例如 link https://gitlab.com/xxxxx/myproject.git 如果我点击 link repository: https://gitlab.com/xxxxx/myproject/tree/master 有三个目录: client/myprojecty, server/myserverproject, sketch/mysketchserver

项目 android 在 client/myprojecty 中,现在我想将位于 C://User/AndroiStudioProject/myproject 的本地项目与 client/project 连接起来,我想使用 android工作室。

我不希望 client/myproject 覆盖我的本地项目 C://User/AndroidStudio/myproject

如何使用 android 工作室?

我在启动 android studio 时尝试过: 从版本控制中签出项目 然后我点击 git 然后打开 diag Clone Repository,其中有要填写的文本字段:

Git 存储库 Url: https://gitlab.com/xxxxx/myproject.git 父目录:C://User/AndroiStudioProject/myproject 目录名称:我的项目

我没有点击克隆,因为我害怕这个命令会覆盖我的本地项目并删除我本地项目中的所有进度。

我如何只将我的本地项目与 gitlab 上的项目连接起来? 那我怎么更新进度呢?

首先复制你的项目文件夹(做这些事情时总是这样做以防万一)

然后打开您的项目并进入 android studio 中的终端选项卡并输入

   git init

现在您的本地项目由 git 控制。但是如何将它连接到您的远程项目如下所示:

git remote add origin [the address of your remote repo]

然后输入:

git add .

并提交如下更改:

git commit -m "first commit"

然后键入此内容以推送到服务器:

git push -u origin master

如果有任何问题,请评论此 post,我会帮助你。