git 备份和恢复

实际应用

设置之前要在个人用户设置中增加key(为了备份ssh的项目)

备份

进入ditlab容器

cd /home/git/gitlab

bundle exec rake gitlab:backup:create RAILS_ENV=production

cd /home/git/gitlab

bundle exec bin/rake gitlab:backup:restore RAILS_ENV=production

chown git:git -R /opt/gitlab-7.11.4-0/apps/gitlab/repositories

以上为自我时间内容,以下为转载其他人内容

gitlab的安装以及备份恢复 2015-08-07 15:22:03

分类: 项目管理

下载安装包wget https://downloads.bitnami.com/files/stacks/gitlab/7.11.4-0/bitnami-gitlab-7.11.4-0-linux-x64-installer.run
   然后更改成执行权限:chmod a+x bitnami-gitlab-7.11.4-0-linux-x64-installer.run
   再执行安装:./bitnami-gitlab-7.11.4-0-linux-x64-installer.run
   按照提示安装输入Y/N安装:

点击(此处)折叠或打开

  1. [[email protected] ~]# ./bitnami-gitlab-7.11.4-0-linux-x64-installer.run
  2. The installer detects that exists a ‘git‘ user in the system. This installer will change the configuration for this user. Do you want to continue the installation? [y/N]: y
  3. The installer detects that exists a ‘gitlab_ci‘ user in the system. This installer will change the configuration for this user. Do you want to continue the installation? [y/N]: y
  4. ----------------------------------------------------------------------------
  5. Welcome to the Bitnami Gitlab Stack Setup Wizard.
  6. ----------------------------------------------------------------------------
  7. Select the components you want to install; clear the components you do not want
  8. to install. Click Next when you are ready to continue.
  9. PhpPgAdmin [Y/n] :Y
  10. GitLab : Y (Cannot be edited)
  11. GitLab CI [Y/n] :Y
  12. Is the selection above correct? [Y/n]: Y
  13. ----------------------------------------------------------------------------
  14. Installation folder
  15. Please, choose a folder to install Bitnami Gitlab Stack
  16. Select a folder [/opt/gitlab-7.11.4-0]: /opt/bitnami
  17. ----------------------------------------------------------------------------
  18. Create Admin account
  19. Bitnami Gitlab Stack admin user creation
  20. Email Address [[email protected]]: [email protected]
  21. Login [user]: test
  22. Password :
  23. Please confirm your password :
  24. ----------------------------------------------------------------------------
  25. Hostname that will be used to create internal URLs. If this value is incorrect,
  26. you may be unable to access your Gitlab installation from other computers. It is
  27. advisable to use a Domain instead of an IP address for compatibility with
  28. different browsers.
  29. Domain [127.0.0.1]: test.gitlab.com
  30. Do you want to configure mail support? [y/N]: N
  31. ----------------------------------------------------------------------------
  32. Setup is now ready to begin installing Bitnami Gitlab Stack on your computer.
  33. Do you want to continue? [Y/n]: Y
  34. ----------------------------------------------------------------------------
  35. Please wait while Setup installs Bitnami Gitlab Stack on your computer.
  36. Installing
  37. 0% ______________ 50% ______________ 100%
  38. #########################################
  39. ----------------------------------------------------------------------------
  40. Setup has finished installing Bitnami Gitlab Stack on your computer.
  41. Info: To access the Bitnami Gitlab Stack, go to
  42. http://dev.domain.org:80 from your browser.
  43. Press [Enter] to continue:

上面红色标志的按照自己喜好设置了,如安装路径、admin用户等。
      到此,整个安装结束,设置好HOST后访问test.gitlab.com就可以正常使用了。

备份以及恢复的操作,以下操作使用root用户执行:

1、指定备份路径vi /opt/gitlab-6.4.3-1/apps/gitlab/htdocs/config/gitlab.yml,找到如下所示修改

点击(此处)折叠或打开

  1. ## Backup settings
  2. backup:
  3. path: "/tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)

2、执行备份

点击(此处)折叠或打开

  1. cd /opt/gitlab-7.11.4-0/
  2. ./use_gitlab
  3. cd /opt/gitlab-7.11.4-0/apps/gitlab/htdocs
  4. bundle exec bin/rake gitlab:backup:create RAILS_ENV=production

操作执行完毕,会在/tmp/backups/目录下生产一个备份文件,类似1438917368_gitlab_backup.tar

3、恢复备份的数据

点击(此处)折叠或打开

  1. cd /opt/gitlab-7.11.4-0/
  2. ./use_gitlab
  3. cd /opt/gitlab-7.11.4-0/apps/gitlab/htdocs
  4. bundle exec bin/rake gitlab:backup:restore RAILS_ENV=production
  5. chown git:git -R /opt/gitlab-7.11.4-0/apps/gitlab/repositories

如果备份的目录下不止一个备份文件,则RAILS_ENV=production后面需要指定备份文件 BACKUP=xxx。
       至此备份恢复完毕。

时间: 2024-08-28 08:33:22

git 备份和恢复的相关文章

Gitlab备份和恢复操作记录

前面已经介绍了Gitlab环境部署记录,这里简单说下Gitlab的备份和恢复操作记录: 1)Gitlab的备份目录路径设置 [[email protected] ~]# vim /etc/gitlab/gitlab.rb gitlab_rails['backup_path'] = "/data/gitlab/backups" [[email protected] ~]# mkdir -p /data/gitlab/backups [[email protected] ~]# chown

gitlab安装,使用,备份,恢复

gitlab安装,使用,备份,恢复 git是一个版本控制器在分布式版本控制系统里,客户端并不只提取最新版本的文件快照,而是把代码仓库完整地镜像下来. 这么一来,任何一处协同工作用的服务器发生故障,事后都可以用任何一个镜像出来的本地仓库恢复.因为每一次的提取操作,实际上都是一次对代码仓库的完整备份. 1.gitlab介绍 GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务,操作起来特别方便. 2.Gitlab安装与配置 2.1yum安装软件

索引,视图,导入导出,备份,恢复

一.实验介绍 1.1 实验内容 本节实验中我们将学习并实践数据库的其他基本操作:索引.视图,导入和导出,备份和恢复等. 这些概念对于数据库管理员而言都非常重要,请仔细理解并完成所有实验操作. 1.2 实验知识点 索引 视图 导入和导出 备份和恢复 1.3 实验环境 课程使用的实验环境为 Ubuntu Linux 14.04 64 位版本.实验中会用到程序: Mysql 5.5.50 Xfce终端 二.开发准备 注:如果你是从上一节直接进入本节进行学习的,请先删除上一节建立的数据库mysql_sh

Git 将代码恢复到一个历史的版本

Git 将代码恢复到一个历史的版本 要把代码回到某个历史版本 比如 test有两种方法 暴力的方式 如果你的仓库是自己在用(不影响别人),那么你可以使用 git reset --hard <target_commit_id> 来恢复到指定的提交,再用 git push -f 来强制更新远程的分支指针.为了保证万一需要找回历史提交,我们可以先打一个 tag 来备份. 对于刚刚的例子,需要执行的命令就是: // 备份当前的分支到 backup_commit git tag backup_commi

MySQL优化之——备份和恢复

转载请注明出处:http://blog.csdn.net/l1028386804/article/details/46766919 备份 逻辑备份方法 使用MYSQLDUMP命令备份 MYSQLDUMP是MYSQL提供的一个非常有用的数据库备份工具.mysqldump命令执行时将数据库备份成一个文本文件,该文件中实际上包含了多个CREATE 和INSERT语句,使用这些语句可以重新创建表和插入数据 MYSQLDUMP的语法和选项 mysqldump -u user -p pwd -h host

备份和恢复数据库

查看实例编号,名称和日志模式:SYS AS [email protected]>select dbid,name,log_mode from v$database; DBID NAME      LOG_MODE---------- --------- ------------1391294860 ORCL      ARCHIVELOG 1 row selected. RMAN:    登录:    [[email protected] ~]$ rman    RMAN> CONNECT T

Linux系统中备份和恢复MongoDB数据的教程

版本:mongodb3.2.6 备份格式: /data/mongodb/bin/mongodump -h IP --port 端口号 -u 用户 -p 密码-d 数据库名-o 存储路径 恢复格式: /mnt/mongodb/bin/mongorestore -h IP --port 端口号 -u 用户名-p密码  -d 数据库名 备份的文件夹名/* 注意,如果mongodb开启了认证登录,那么需要加参数--authenticationDatabase=admin, 因为笔者使用的mongodb开

Mysql备份和恢复

Mysql备份和恢复 备份 热备,是指对数据库运行中直接进行备份,对正在运行的数据库没有任何影响: 冷备,是指在数据库停止(关闭)下进行备份,只需拷贝相关的数据物理文件: 温备,是指对数据库运行中直接进行备份,但对当前数据库操作有所影响,很少用. 按备份出来的文件内容分为: 逻辑备份: 裸文件备份. 逻辑备份后文件内容是可读的,通常是文本文件,内容一般是Sql语句或表内的实际数据,如mysqldump或select * into outfile等方法.适用于数据库的升级.迁移,恢复时间较长. 裸

从SQL Server中清除msdb备份和恢复记录

正如我在前面的技巧“您的数据库上次恢复是什么时候呢?”中提到的,SQL Server使msdb数据库内系统表中的备份和恢复记录保持激活状态.没有正常的维护,这些系统表将变得很大,从而导致对于msdb数据库整体超大. 这些msdb表包括:       backupfile backupfilegroup backupmediafamily backupmediaset backupset restorefile restorefilegroup restorehistory 幸运的是,微软提供了两