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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39994482/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:20:38  来源:igfitidea点击:

Connect my project to gitlab with android studio

androidgitandroid-studiogitlab

提问by Fra87

my friend have create a project on gitlab, when i signin gitlab i view project xxxxx/project if i click on it, i enter in project and i can select link ssh or httsp. For example link https://gitlab.com/xxxxx/myproject.gitIf i click link repository: https://gitlab.com/xxxxx/myproject/tree/masterthere are three directory: client/myprojecty, server/myserverproject, sketch/mysketchserver

我的朋友在 gitlab 上创建了一个项目,当我登录 gitlab 时,如果我点击它,我会查看项目 xxxxx/project,我进入项目,我可以选择链接 ssh 或 httsp。例如链接https://gitlab.com/xxxxx/myproject.git如果我单击链接存储库:https: //gitlab.com/xxxxx/myproject/tree/master有三个目录:client/myprojecty、server/myserverproject、草图/我的草图服务器

Project android is in client/myprojecty, now i want connect my local project that is located into C://User/AndroiStudioProject/myproject with client/project and i want use android studio.

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

I don't want that client/myproject overwrite my local project C://User/AndroidStudio/myproject

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

How do i with android studio?

我如何使用android studio?

I have try when starup android studio: Check out project from Version Control then i click git Then open dialg Clone Repository where there is text field to fill:

我在启动 android studio 时尝试过:从版本控制中查看项目,然后单击 git 然后打开 dilg Clone Repository,其中有文本字段要填充:

Git Reposiroy Url: https://gitlab.com/xxxxx/myproject.gitParent Directory: C://User/AndroiStudioProject/myproject Directory Name: myproject

Git Reposiroy Url:https: //gitlab.com/xxxxx/myproject.git父目录:C://User/AndroiStudioProject/myproject 目录名称:myproject

I have not clicked clone because i'm scared that this command overwrite my local project and delete all progress in my local project.

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

How i do only connect my local project with project on gitlab? Then how i update my progress?

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

回答by Amir Ziarati

First of all make a copy of your project folder (do it always when doung these kind of things just in case)

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

Then open your project and go terminal tab in android studio and type

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

   git init

Now your local project is controlled by git. But how to connect it to your remote project is like below:

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

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

Then just type:

然后只需键入:

git add .

And commit your changes like below:

并提交您的更改,如下所示:

git commit -m "first commit"

Then type this to push on server:

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

git push -u origin master

If anything went wrong comment this post and ill help you.

如果出现任何问题,请评论此帖子并帮助您。