Gitlab 如何将 Gitlab 与 Git 同步
Gitlab how to Synchronize Gitlab with Git
我想知道,是否可以将 Gitlab 项目与 Git 控制台同步,因为所有时间都必须下载项目 .zip 或任何程序以供使用,例如 Github 客户端?
不要下载存储库的 .zip,而是使用 git 命令行工具克隆存储库。例如,要使用 HTTPS 克隆 GitLab CE 存储库:
git clone https://gitlab.com/gitlab-org/gitlab-ce.git
这会将代码克隆到 gitlab-ce
目录中。更改到这个新目录。从现在开始,使用 git pull origin master
、git push origin master
和其他 git 命令与远程存储库进行交互。
有关 Git 基础知识和使用 GitLab 的更多信息,请参阅 http://doc.gitlab.com/ce/gitlab-basics/README.html
如果你想使用 HTTPS,另一个答案是正确的,但如果你want/prefer使用 SSH,你可以这样做!
- 将 github_rsa.pub 中的 public ssh 密钥(位于您的 .ssh 文件夹中)添加到 Gitlab.com
上的 SSH 密钥
将 config
文件添加到您的 .ssh 文件夹中,如下所示
Host gitlab.com
RSAAuthentication yes
IdentityFile ~/.ssh/github_rsa
User mygitlabusername
通过 Git 克隆/拉取您的存储库 Bash
- 将文件夹拖到 Github For Windows
我想知道,是否可以将 Gitlab 项目与 Git 控制台同步,因为所有时间都必须下载项目 .zip 或任何程序以供使用,例如 Github 客户端?
不要下载存储库的 .zip,而是使用 git 命令行工具克隆存储库。例如,要使用 HTTPS 克隆 GitLab CE 存储库:
git clone https://gitlab.com/gitlab-org/gitlab-ce.git
这会将代码克隆到 gitlab-ce
目录中。更改到这个新目录。从现在开始,使用 git pull origin master
、git push origin master
和其他 git 命令与远程存储库进行交互。
有关 Git 基础知识和使用 GitLab 的更多信息,请参阅 http://doc.gitlab.com/ce/gitlab-basics/README.html
如果你想使用 HTTPS,另一个答案是正确的,但如果你want/prefer使用 SSH,你可以这样做!
- 将 github_rsa.pub 中的 public ssh 密钥(位于您的 .ssh 文件夹中)添加到 Gitlab.com 上的 SSH 密钥
将
config
文件添加到您的 .ssh 文件夹中,如下所示Host gitlab.com RSAAuthentication yes IdentityFile ~/.ssh/github_rsa User mygitlabusername
通过 Git 克隆/拉取您的存储库 Bash
- 将文件夹拖到 Github For Windows