草庐IT

版本控制gitlab

tushanbu 2023-03-28 原文

版本控制gitlab


版本控制介绍

版本控制是指对软件开发过程中各种程序代码、配置文件及说明文档等文件变更的管理,是软件配置管理的核心思想之一。

版本控制最主要的功能就是追踪文件的变更。它将什么时候、什么人更改了文件的什么内容等信息忠实地了记录下来。每一次文件的改变,文件的版本号都将增加。除了记录版本变更外,版本控制的另一个重要功能是并行开发。软件开发往往是多人协同作业,版本控制可以有效地解决版本的同步以及不同开发者之间的开发通信问题,提高协同开发的效率。并行开发中最常见的不同版本软件的错误(Bug)修正问题也可以通过版本控制中分支与合并的方法有效地解决。

具体来说,在每一项开发任务中,都需要首先设定开发基线,确定各个配置项的开发初始版本,在开发过程中,开发人员基于开发基线的版本,开发出所需的目标版本。当发生需求变更时,通过对变更的评估,确定变更的影响范围,对被影响的配置项的版本进行修改,根据变更的性质使配置项的版本树继续延伸或产生新的分支,形成新的目标版本,而对于不受变更影响的配置项则不应发产生变动。同时,应能够将变更所产生的对版本的影响进行记录和跟踪。必要时还可以回退到以前的版本。例如当开发需求或需求变更被取消时,就需要有能力将版本回退到开发基线版本。在曾经出现过的季度升级包拆包和重新组包的过程中,其实就是将部分配置项的版本回退到开发基线,将对应不同需求的不同分支重新组合归并,形成新的升级包版本。
版本控制是软件配置管理的核心功能。所有置于配置库中的元素都应自动予以版本的标识,并保证版本命名的唯一性。版本在生成过程中,自动依照设定的使用模型自动分支、演进。除了系统自动记录的版本信息以外,为了配合软件开发流程的各个阶段。还需要定义、收集一些元数据来记录版本的辅助信息和规范开发流程,并为今后对软件过程的度量做好准备。当然如果选用的工具支持,这些辅助数据将能直接统计出过程数据,从而方便软件过程改进活动的进行。对于配置库中的各个基线控制项,应该根据其基线的位置和状态来设置相应的访问权限。一般来说,对于基线版本之前的各个版本都应处于被锁定的状态,如需要对它们进行变更,则应按照变更控制的流程来进行操作。

常用的版本控制工具:

itlab 公司服务器搭建,用来存放开发人员的代码
svn (subversion):是一个自由开源的版本控制系统
文件和目录可以超越时空。Subversion将文件存放在中心版本库里,这个版本库很像一个普通的文件服务器,不同的是,它可以记录每一次文件和目录的修改情况,这样就可以借此将数据恢复到以前的版本,并可以查看数据的更改细节
github 国外
码云gitee 国内

gitlab部署

部署需要至少4GB内存运行,虚拟机内核也作一下调整,如果不够尽量调制最高,方便后面编译
需要的依赖包
pkgs官网
policycoreutils-python
清华大学官网
gitlab-ce

配置yum源:
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# wget /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
[root@localhost yum.repos.d]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
配置epel源:
[root@localhost yum.repos.d]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
[root@localhost yum.repos.d]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
[root@localhost yum.repos.d]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
关闭防火墙:
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# vim /etc/selinux/config 
SELINUX=disabled
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl disable firewalld.service 
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
卸载依赖包:
[root@localhost ~]# dnf -y remove policycoreutils
安装依赖包:
[root@localhost ~]# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/policycoreutils-python-2.5-34.el7.x86_64.rpm  https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm
[root@localhost ~]# ls
anaconda-ks.cfg  gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm  policycoreutils-python-2.5-34.el7.x86_64.rpm
[root@localhost ~]# dnf -y install epel-release git curl openssh-server openssh-clients postfix cronie perl
安装policycoreutils-python:
[root@localhost ~]# rpm -ivh --nodeps policycoreutils-python-2.5-34.el7.x86_64.rpm
warning: policycoreutils-python-2.5-34.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:policycoreutils-python-2.5-34.el7################################# [100%]
安装gitlab-ce:
[root@localhost ~]# rpm -ivh gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm 
warning: gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:gitlab-ce-15.3.3-ce.0.el7        ################################# [100%]
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=15-3
启动postfix服务并设置开机自启:
[root@localhost ~]# systemctl enable --now postfix
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.
修改配置文件:
[root@localhost ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.222.250' //修改为主机的ip
重载配置文件并重启gitlab:
第一次需要等好一会
[root@localhost ~]# export LANG=en_US.UTF-8
[root@localhost ~]# bash
[root@localhost ~]# gitlab-ctl reconfigure
....
[2022-09-23T04:44:16+08:00] INFO: Running report handlers
Running handlers complete
[2022-09-23T04:44:16+08:00] INFO: Report handlers complete
Infra Phase complete, 0/778 resources updated in 19 seconds
gitlab Reconfigured!
[root@localhost ~]# ss -antl    //有差不多24个端口
State      Recv-Q     Send-Q          Local Address:Port           Peer Address:Port     Process     
LISTEN     0          1024                127.0.0.1:9121                0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:9090                0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:9187                0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:9093                0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:9100                0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:9229                0.0.0.0:*                    
LISTEN     0          128                 127.0.0.1:9168                0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:8080                0.0.0.0:*                    
LISTEN     0          511                   0.0.0.0:80                  0.0.0.0:*                    
LISTEN     0          128                 127.0.0.1:8082                0.0.0.0:*                    
LISTEN     0          128                 127.0.0.1:9236                0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:8150                0.0.0.0:*                    
LISTEN     0          128                   0.0.0.0:22                  0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:8151                0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:8153                0.0.0.0:*                    
LISTEN     0          100                 127.0.0.1:25                  0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:8154                0.0.0.0:*                    
LISTEN     0          1024                127.0.0.1:8155                0.0.0.0:*                    
LISTEN     0          128                 127.0.0.1:8092                0.0.0.0:*                    
LISTEN     0          511                   0.0.0.0:8060                0.0.0.0:*                    
LISTEN     0          1024                        *:9094                      *:*                    
LISTEN     0          128                     [::1]:9168                   [::]:*                    
LISTEN     0          128                      [::]:22                     [::]:*                    
LISTEN     0          100                     [::1]:25                     [::]:*        
[root@localhost ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 151481) 1s
ok: run: gitaly: (pid 151496) 1s
ok: run: gitlab-exporter: (pid 151526) 0s
ok: run: gitlab-kas: (pid 151566) 1s
ok: run: gitlab-workhorse: (pid 151595) 0s
ok: run: logrotate: (pid 151619) 1s
ok: run: nginx: (pid 151637) 0s
ok: run: node-exporter: (pid 151645) 1s
ok: run: postgres-exporter: (pid 151671) 0s
ok: run: postgresql: (pid 151680) 0s
ok: run: prometheus: (pid 151726) 1s
ok: run: puma: (pid 151986) 0s
ok: run: redis: (pid 152046) 1s
ok: run: redis-exporter: (pid 152056) 0s
ok: run: sidekiq: (pid 152205) 0s
查看当前的gitlab版本:
[root@localhost ~]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 15.3.3
破解管理员密码:
[root@localhost ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
 GitLab:       15.3.3 (c629a47f87f) FOSS
 GitLab Shell: 14.10.0
 PostgreSQL:   13.6
------------------------------------------------------------[ booted in 45.73s ]
Loading production environment (Rails 6.1.6.1)
irb(main):001:0> user = User.where(id: 1).first  //id为1的是超级管理员
=> #<User id:1 @root>
irb(main):002:0> user.password='xbz123456' //密码必须至少8个字符
=> "xbz123456"
irb(main):003:0> user.password_confirmation ="xbz123456"
=> "xbz123456"                       
irb(main):004:0> user.save!       //保存修改,若无问题将返回true
=> true
irb(main):005:0> exit        //退出    

访问:
登录界面

输入管理员用户以及刚刚设置的密码

gitlab网页界面的基本使用

更改为中文版


使用gitlab管理员给其他用户登录操作





添加一个项目然后进行设置ssh免密登录





没有公钥信息可以在服务器上面生成一个,将存放公钥目录里面的进行复制,注意空格不要复制进去了

[root@localhost ~]# ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):   //存放私钥的地址
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub. //存放公钥的地址
The key fingerprint is:
SHA256:6oKr97Grf534d1mai/LbWjuX1DZtkEGUXcOsgyQk/XY root@localhost
The key's randomart image is:
+---[RSA 3072]----+
|       .o.   o=+o|
|        .o .  ooo|
|          + . .o |
|           + Eo  |
|        S . . .o.|
|       .      o.=|
|   .. .o .  .* +.|
|  o .+o + .+*.o  |
|.oo==+...+=+++   |
+----[SHA256]-----+
[root@localhost ~]# cat /root/.ssh/id_rsa.pub  //查看公钥目录
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDH+j7R/roIHTxgwExOsT3p9tHTwX8EQcVBJenPipZTcIwJ+snbODEOQYDfNGbsmyuTaPDzIWdcJHJXtWd4gXfquwm18Ii5qkl3HKxMs8G0/LEGhryLbX+FcslI/0JOGZuAdKfNVZV1UFarNkj8dpAqb4oeEQ8iTjUkO+qJyjY+NH3Qrxn1NR9fMy+7991WU9PCNoVIxXutohvWypiT4EM3/FndRBzZuUyN3YseOnYHjBnGoGrllABAwJaJRM9XC9YD4znXigUPUcnhC9l2PSMAQorEWfbqIttx14ttfFQrE0tOLGiIQ1N+XpkhzsJHs3iNlmPBqbqqXzTsduDQxHgrMGdwP5Kuk8fp3UP145shvUJCzYCDz0QPYO9wqwySE64iJ0lY41V0pPINqPzEsaEt7y30CvqHMSKJ7cOOj22FABuTC2GDGjsKKNSRCpRFrYq5D+Bg2oUZB52GEBxMQXyjTP9gAFlr9+pzjpHUFqTQ2wuxIqr8qoHMhQKGKbcWd8k= root@localhost



回到刚刚创建的项目那里



创建组





创建用户





将用户添加到组里面





查看刚刚添加进来的用户




创建项目让组内的成员有权限去访问




给创建的用户设置密码




使用刚刚创建的用户进行登录刚刚创建项目里面





在项目上面上传文件


使用命令行的方式进行上传文件

git clone //克隆
git add //添加
git push //上传
git commit //提交
git branch //切换
git pull //拉取

[root@localhost ~]# git clone http://192.168.222.250/gitlab-instance-75e9fc3c/xbz.git  //将刚刚克隆的复制到这里
Cloning into 'xbz'...
Username for 'http://192.168.222.250': root
Password for 'http://root@192.168.222.250': 
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 2.79 KiB | 2.79 MiB/s, done.
[root@localhost ~]# ls
anaconda-ks.cfg                       policycoreutils-python-2.5-34.el7.x86_64.rpm
gitlab-ce-15.3.3-ce.0.el7.x86_64.rpm  xbz  //可以查看到项目
[root@localhost ~]# cd xbz/
[root@localhost xbz]# ls
README.md
[root@localhost xbz]# git config --local user.email "136@78.com" //自定义一下邮箱
[root@localhost xbz]# git config --global user.name "root"
//自定义一下用户名
[root@localhost xbz]# ls
README.md
[root@localhost xbz]# touch file1  //创建文件
[root@localhost xbz]# ls
README.md  file1
[root@localhost xbz]# git add file1  //将文件添加
[root@localhost xbz]# git commit    //提交文件
Aborting commit due to empty commit message.
[root@localhost xbz]# git commit -m "add file1" //提交
[main 757d06a] add file1
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 file1
[root@localhost xbz]# git push  //进行上传
Username for 'http://192.168.222.250': root   //如果没有设置免密登录,这里要输入用户名和密码
Password for 'http://root@192.168.222.250': 
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 255 bytes | 255.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To http://192.168.222.250/gitlab-instance-75e9fc3c/xbz.git
   fb8ebac..757d06a  main -> main

查看是否上传

创建分支进行合并

[root@localhost xbz]# git branch dex
root@localhost xbz]# git push origin dex 
Username for 'http://192.168.222.250': root
Password for 'http://root@192.168.222.250': 
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: 
remote: To create a merge request for dex, visit:
remote:   http://192.168.222.250/gitlab-instance-75e9fc3c/xbz/-/merge_requests/new?merge_request%5Bsource_branch%5D=dex
remote: 
To http://192.168.222.250/gitlab-instance-75e9fc3c/xbz.git
 * [new branch]      dex -> dex

可以查看到分支创建成功

将文件上传到刚刚创建的分支里面

[root@localhost xbz]# git checkout dex  //通过命令切换分支
Switched to branch 'dex'
[root@localhost xbz]# touch files3  //创建文件
[root@localhost xbz]# git add files3  //添加文件
[root@localhost xbz]# git commit -m "add files3" //提交上传信息
[dex c9b8f17] add files3
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 files3
[root@localhost xbz]# git push   //第一次上传会有提示要有下面的命令上传 
fatal: The current branch dex has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin dex

[root@localhost xbz]# git push --set-upstream origin dex //将之前的分支合并了然后上传
Username for 'http://192.168.222.250': root
Password for 'http://root@192.168.222.250': 
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 254 bytes | 254.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
remote: 
remote: To create a merge request for dex, visit:
remote:   http://192.168.222.250/gitlab-instance-75e9fc3c/xbz/-/merge_requests/new?merge_request%5Bsource_branch%5D=dex
remote: 
To http://192.168.222.250/gitlab-instance-75e9fc3c/xbz.git
   757d06a..c9b8f17  dex -> dex
Branch 'dex' set up to track remote branch 'dex' from 'origin'.

查看上传

再次创建文件进行上传
第二次上传就不用执行合并那个操作

[root@localhost xbz]# touch files4
[root@localhost xbz]# git add files4 
[root@localhost xbz]# git commit -m "add files4"
[dex b6b67c6] add files4
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 files4
[root@localhost xbz]# git push 
Username for 'http://192.168.222.250': root
Password for 'http://root@192.168.222.250': 
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 223 bytes | 223.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
remote: 
remote: To create a merge request for dex, visit:
remote:   http://192.168.222.250/gitlab-instance-75e9fc3c/xbz/-/merge_requests/new?merge_request%5Bsource_branch%5D=dex
remote: 
To http://192.168.222.250/gitlab-instance-75e9fc3c/xbz.git
   c9b8f17..b6b67c6  dex -> dex

查看上传

对上传的文件进行拉取
将别的分支的文件拉取到你需要的那个分支里面

[root@localhost xbz]# git checkout main //切换到main分支
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
[root@localhost xbz]# git pull origin dex  //将dex这个分支里面的文件都拉取到本地上面了
warning: Pulling without specifying how to reconcile divergent branches is
discouraged. You can squelch this message by running one of the following
commands sometime before your next pull:

  git config pull.rebase false  # merge (the default strategy)
  git config pull.rebase true   # rebase
  git config pull.ff only       # fast-forward only

You can replace "git config" with "git config --global" to set a default
preference for all repositories. You can also pass --rebase, --no-rebase,
or --ff-only on the command line to override the configured default per
invocation.

Username for 'http://192.168.222.250': root
Password for 'http://root@192.168.222.250': 
From http://192.168.222.250/gitlab-instance-75e9fc3c/xbz
 * branch            dex        -> FETCH_HEAD
Updating 757d06a..b6b67c6
Fast-forward
 files3 | 0
 files4 | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 files3
 create mode 100644 files4
[root@localhost xbz]# git push //可以直接使用push上传
Username for 'http://192.168.222.250': root
Password for 'http://root@192.168.222.250': 
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To http://192.168.222.250/gitlab-instance-75e9fc3c/xbz.git
   757d06a..b6b67c6  main -> main

查看上传

有关版本控制gitlab的更多相关文章

  1. Ruby Readline 在向上箭头上使控制台崩溃 - 2

    当我在Rails控制台中按向上或向左箭头时,出现此错误:irb(main):001:0>/Users/me/.rvm/gems/ruby-2.0.0-p247/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in`blockin_rl_dispatch_subseq':invalidbytesequenceinUTF-8(ArgumentError)我使用rvm来管理我的ruby​​安装。我正在使用=>ruby-2.0.0-p247[x86_64]我使用bundle来管理我的gem,并且我有rb-readline(0.4.2)(人们推荐的最少

  2. ruby-on-rails - 项目升级后 Pow 不会更改 ruby​​ 版本 - 2

    我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby​​版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby​​版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘

  3. ruby-on-rails - 带 Spring 锁的 Rails 4 控制台 - 2

    我正在使用Ruby2.1.1和Rails4.1.0.rc1。当执行railsc时,它被锁定了。使用Ctrl-C停止,我得到以下错误日志:~/.rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/run.rb:47:in`gets':Interruptfrom~/.rvm/gems/ruby-2.1.1/gems/spring-1.1.2/lib/spring/client/run.rb:47:in`verify_server_version'from~/.rvm/gems/ruby-2.1.1/gems/spring-1.1.

  4. ruby-on-rails - 在 ruby​​ .gemspec 文件中,如何指定依赖项的多个版本? - 2

    我正在尝试修改当前依赖于定义为activeresource的gem:s.add_dependency"activeresource","~>3.0"为了让gem与Rails4一起工作,我需要扩展依赖关系以与activeresource的版本3或4一起工作。我不想简单地添加以下内容,因为它可能会在以后引起问题:s.add_dependency"activeresource",">=3.0"有没有办法指定可接受版本的列表?~>3.0还是~>4.0? 最佳答案 根据thedocumentation,如果你想要3到4之间的所有版本,你可以这

  5. ruby-on-rails - openshift 上的 rails 控制台 - 2

    我将我的Rails应用程序部署到OpenShift,它运行良好,但我无法在生产服务器上运行“Rails控制台”。它给了我这个错误。我该如何解决这个问题?我尝试更新ruby​​gems,但它也给出了权限被拒绝的错误,我也无法做到。railsc错误:Warning:You'reusingRubygems1.8.24withSpring.UpgradetoatleastRubygems2.1.0andrun`gempristine--all`forbetterstartupperformance./opt/rh/ruby193/root/usr/share/rubygems/rubygems

  6. ruby-on-rails - 如果我将 ruby​​ 版本 2.5.1 与 rails 版本 2.3.18 一起使用会怎样? - 2

    如果我使用ruby​​版本2.5.1和Rails版本2.3.18会怎样?我有基于rails2.3.18和ruby​​1.9.2p320构建的rails应用程序,我只想升级ruby的版本,而不是rails,这可能吗?我必须面对哪些挑战? 最佳答案 GitHub维护apublicfork它有针对旧Rails版本的分支,有各种变化,它们一直在运行。有一段时间,他们在较新的Ruby版本上运行较旧的Rails版本,而不是最初支持的版本,因此您可能会发现一些关于需要向后移植的有用提示。不过,他们现在已经有几年没有使用2.3了,所以充其量只能让更

  7. ruby-on-rails - 获取 inf-ruby 以使用 ruby​​ 版本管理器 (rvm) - 2

    我安装了ruby​​版本管理器,并将RVM安装的ruby​​实现设置为默认值,这样'哪个ruby'显示'~/.rvm/ruby-1.8.6-p383/bin/ruby'但是当我在emacs中打开inf-ruby缓冲区时,它使用安装在/usr/bin中的ruby​​。有没有办法让emacs像shell一样尊重ruby​​的路径?谢谢! 最佳答案 我创建了一个emacs扩展来将rvm集成到emacs中。如果您有兴趣,可以在这里获取:http://github.com/senny/rvm.el

  8. ruby-on-rails - 如何在发布新的 Ruby 或 Rails 版本时收到通知? - 2

    有人知道在发布新版本的Ruby和Rails时收到电子邮件的方法吗?他们有邮件列表,RubyonRails有一个推特,但我不想听到那些随之而来的喧嚣,我只想知道什么时候发布新版本,尤其是那些有安全修复的版本。 最佳答案 从therailsblog获取提要.http://weblog.rubyonrails.org/feed/atom.xml 关于ruby-on-rails-如何在发布新的Ruby或Rails版本时收到通知?,我们在StackOverflow上找到一个类似的问题:

  9. 【鸿蒙应用开发系列】- 获取系统设备信息以及版本API兼容调用方式 - 2

    在应用开发中,有时候我们需要获取系统的设备信息,用于数据上报和行为分析。那在鸿蒙系统中,我们应该怎么去获取设备的系统信息呢,比如说获取手机的系统版本号、手机的制造商、手机型号等数据。1、获取方式这里分为两种情况,一种是设备信息的获取,一种是系统信息的获取。1.1、获取设备信息获取设备信息,鸿蒙的SDK包为我们提供了DeviceInfo类,通过该类的一些静态方法,可以获取设备信息,DeviceInfo类的包路径为:ohos.system.DeviceInfo.具体的方法如下:ModifierandTypeMethodDescriptionstatic StringgetAbiList​()Obt

  10. C51单片机——实现用独立按键控制LED亮灭(调用函数篇) - 2

    说在前面这部分我本来是合为一篇来写的,因为目的是一样的,都是通过独立按键来控制LED闪灭本质上是起到开关的作用,即调用函数和中断函数。但是写一篇太累了,我还是决定分为两篇写,这篇是调用函数篇。在本篇中你主要看到这些东西!!!1.调用函数的方法(主要讲语法和格式)2.独立按键如何控制LED亮灭3.程序中的一些细节(软件消抖等)1.调用函数的方法思路还是比较清晰地,就是通过按下按键来控制LED闪灭,即每按下一次,LED取反一次。重要的是,把按键与LED联系在一起。我打算用K1来作为开关,看了一下开发板原理图,K1连接的是单片机的P31口,当按下K1时,P31是与GND相连的,也就是说,当我按下去时

随机推荐