简体   繁体   English

将 Git 存储库导入 GitLab 时会发生什么

[英]What Happens When Import Git Repos to GitLab

I am wondering if someone could please help me understand what exactly happens when we import Git Repos to Gitlab.我想知道是否有人可以帮助我了解当我们将 Git Repos 导入 Gitlab 时到底发生了什么。 Does metadata change?元数据会改变吗? Are some database entries made on Gitlab side.是否在 Gitlab 端创建了一些数据库条目。 The reason I am asking this is why we cannot use gitlab without importing git repos to gitlab first.我问这个的原因是为什么我们不能在不先将 git repos 导入 gitlab 的情况下使用 gitlab。 Is there a way to make gitlab work with git repos out of the box without importing them.有没有办法让 gitlab 开箱即用地使用 git repos 而无需导入它们。

Furthermore, any helpful links that describe overall architecture of gitlab and how its different components interact or its workflow?此外,任何有用的链接描述了 gitlab 的整体架构以及它的不同组件如何交互或它的工作流程?

Any help would be highly appreciated.任何帮助将不胜感激。

Thanks.谢谢。

To host a repository on Gitlab, you must first create the repository in the web interface.要在 Gitlab 上托管存储库,您必须首先在 Web 界面中创建存储库。 The project page will give you a repo URL.项目页面将为您提供一个 repo URL。

Push an existing repo to GitLab将现有的 repo 推送到 GitLab

If you want to add an existing git repo to gitlab:如果要将现有的 git repo 添加到 gitlab:

git remote add gitlab <gitlab repo URL>
git push gitlab master

Creating a new repo and push to GitLab创建一个新的仓库并推送到 GitLab

If you're starting a repo from scratch, you can either clone it empty and add stuff to it like this:如果你从头开始一个 repo,你可以将它克隆为空并像这样添加东西:

git clone <gitlab repo URL>
cd repo_folder
# copy files there, create new ones,...
git add your_files
git commit -m "Added new files"
git push origin master

Or, initialize a git repository (in empty folder or folder that has existing code, both are OK), then add/commit:或者,初始化一个 git 存储库(在空文件夹或具有现有代码的文件夹中,两者都可以),然后添加/提交:

cd some_project_folder
git init
git remote add gitlab <gitlab repo URL>
git add .
git commit -m "Initial commit"
git push gitlab master

This is a very old question, and things may have changed since it was asked, but to answer them today (the latest GitLab release currently is 14.10, with 15.0 due on 22nd May 2022):这是一个非常古老的问题,自从被问到之后事情可能已经发生了变化,但今天要回答它们(当前最新的GitLab 版本是 14.10,15.0 将于 2022 年 5 月 22 日到期):

  • A high-level architecture overview describes the components of GitLab.高级架构概述描述了 GitLab 的组件。 The component which holds the git repositories is Gitaly拥有 git 存储库的组件是Gitaly
  • One does not need to import git repositories before using GitLab, but can create a new Project without any repository, and then begin to add to it, or create a project from a template在使用 GitLab 之前不需要导入 git 仓库,但可以创建一个没有任何仓库的新项目,然后开始添加,或者从模板创建项目
  • Each GitLab Project can contain a Repository for code (or other project files).每个 GitLab 项目都可以包含一个代码 (或其他项目文件)。 This is the git repository, that provides the revision control functionality in GitLab这是 git 存储库,它在 GitLab 中提供修订控制功能
  • When a project is imported , a new Repository is made to contain the git history, as well as metadata in a database. 导入项目时,会创建一个新的存储库以包含 git 历史记录以及数据库中的元数据。 The database stores information about the repository, but also other Project features such as issues, merge requests, links to other features such as the container registry, a second repository for a wiki, and so on.数据库存储有关存储库的信息,以及其他项目功能,例如问题、合并请求、指向其他功能(例如容器注册表)的链接、wiki 的第二个存储库等。
  • Information about who made commits in a repository, their email address, when the commit was made and so on, is part of the usual git data store.关于谁在存储库中提交、他们的电子邮件地址、提交时间等信息是通常的 git 数据存储的一部分。 When importing, GitLab will attempt to find users matching the email addresses on these commits, but does not create new user accounts for them, or grant permissions on a private project just because a commit was made with a particular email address.导入时,GitLab 将尝试在这些提交中查找与电子邮件地址匹配的用户,但不会为他们创建新用户帐户,或仅因为使用特定电子邮件地址进行提交而授予私有项目的权限。 Users in GitLab must be granted membership to perform actions on private projects. GitLab 中的用户必须被授予成员资格才能对私人项目执行操作。

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

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