git gitlab server install and configure

来源:互联网 发布:读出文字的软件 编辑:程序博客网 时间:2024/06/08 04:09

os user: coober/liu1985


linux user manager

$sudo adduser newuserHow To Grant a User Sudo Privileges,Search for the line that looks like this$visudo->root    ALL=(ALL:ALL) ALLBelow this line, copy the format you see here, changing only the word "root" to reference the new user that you would like to give sudo privileges to:->root    ALL=(ALL:ALL) ALL->newuser ALL=(ALL:ALL) ALLHow To Delete a User#deluser newuseror#deluser --remove-home newuseror#sudo deluser --remove-home newuser#visudo->root    ALL=(ALL:ALL) ALL->newuser ALL=(ALL:ALL) ALL   # DELETE THIS LINE

Install Nginx, MySQL, PHP (LEMP) Stack On Ubuntu 16.04

Note: Depending on your installation you may need to remove apache2. You can do that by running the commands:$sudo apt remove apache2*$sudo apt autoremoveInstalling Nginx on Ubuntu 16.04$sudo apt install nginx$sudo service nginx startInstalling MySQL on Ubuntu 16.04#sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'#sudo apt-get update#sudo apt install mysql-server-5.6 * see note below if you get an error#sudo apt install mysql-client-5.6#sudo mysql_secure_installation#dpkg -l | grep mysql-serverInstalling PHP7 on Ubuntu 16.04$apt install libapache2-mod-php7.0 php7.0 php7.0-fpm php7.0-mysql php7.0-cli php7.0-json php7.0-opcache php7.0-readline php7.0-intl php7.0-xml php7.0-mbstring php7.0-curl php7.0-zip php7.0-mcrypt php7.0-imap$sudo mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.old$sudo nano /etc/nginx/sites-available/default-->server {        listen       80;        server_name  your_site_name.com;        root /usr/share/nginx/html;        index index.php index.html;        location / {                try_files $uri $uri/ =404;        }        error_page 404 /404.html;        error_page 500 502 503 504 /50x.html;        location = /50x.html {                root /var/www/html;        }        location ~ \.php$ {                try_files $uri =404;                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;                fastcgi_index index.php;                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;                include fastcgi_params;        }}$sudo service nginx restart

nginx + fpm conf

server { listen 80; server_name dev.myproj.com; location ~ \.php$ { root  /var/www/myproj/www; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location / { root  /var/www/myproj/www; index  index.php; }}server {     listen 80;     listen [::]:80;     server_name dev.linkall.com;     root /var/www/linkall;     index index.php index.html index.htm index.nginx-debian.html;     location / {        # try to serve file directly, fallback to app.php        try_files $uri /index.php$is_args$args;        #try_files $uri $uri/ =404;     }     location ~ .php$ {       include snippets/fastcgi-php.conf;       #fastcgi_pass unix:/run/php/php7.0-fpm.sock;       fastcgi_pass 127.0.0.1:9000;     }     location ~* ^/index.php {       fastcgi_split_path_info ^(.+.php)(/.+)$;       #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;       fastcgi_pass 127.0.0.1:9000;       fastcgi_index index.php;       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;       include fastcgi_params;       fastcgi_buffer_size 128k;        fastcgi_buffers 256 16k;        fastcgi_busy_buffers_size 256k;        fastcgi_temp_file_write_size 256k;      } }server{listen 80;server_name local.emp.clcw.com.cn;index index.php index.html index.htm;access_log /var/log/nginx/local.emp.clcw.com.cn.log;root /home/vagrant/www/emp.clcw.com.cn;location /{    if (!-e $request_filename){        rewrite ^/index.php(.*)$ /index.php?s=$1 last;        rewrite ^(.*)$ /index.php?s=$1 last;        break;    }}location ~ .*\.(php|php5)?${    fastcgi_pass 127.0.0.1:9001;    #fastcgi_pass unix:/var/run/php5-fpm.sock;    fastcgi_index index.php;    include fastcgi_params;}        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$        {         if (-f $request_filename) {          expires -1s;          break;          }        }location ~ /\.ht{    deny all;}}

create git repository

  • 文档 https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-init

Start using Git on the command line

The most common use case for  git init --bare is to create a remote central repository:$ssh <user>@<host> cd path/above/repo git init --bare my-project.gitor$git init --bare mautic.gitInitializes a new Git repository and copies files from the  <template_directory> into the repository.$git init <directory> --template=<template_directory>$git clone ssh://john@example.com/path/to/my-project.gitCloning to a specific folder$git clone <repo> <directory>Cloning a specific tag$git clone -branch <tag> <repo>Shallow clone$git clone -depth=1 <repo>clone only the new_feature branch from the remote Git repository.$git clone -branch new_feature git://remoterepository.gitThis means that a repository will be set up with the history of the project that can be pushed and pulled from, but cannot be edited directly.$git clone --bareGit URLs, Git has its own URL syntax which is used to pass remote repository locations to Git commands.Git URL protocols:-SSH$ssh://[user@]host.xz[:port]/path/to/repo.git/$git clone ssh://coober@192.168.0.62/var/workspace/git_respository/mautic.git-GIT$git://host.xz[:port]/path/to/repo.git/- HTTPhttp[s]://host.xz[:port]/path/to/repo.git/

git config

Usage$git config user.emailgit config levels and files:    - --local    Local configuration values are stored in a file that can be found in the repo's .git directory: .git/config    - --global    Global configuration values are stored in a file that is located in a user's home directory. ~ /.gitconfig    - --systemWriting a value$git config --global user.email "your_email@example.com"$git config --global merge.tool kdiff3$ git config --global color.ui falseAliases$git config --global alias.ci commit$git config --global alias.amend git ci --amend$git --version$git config --global --list$git pull REMOTE NAME-OF-BRANCH -uCreate a branch$git checkout -b NAME-OF-BRANCH$git checkout NAME-OF-BRANCH$git status$git add CHANGES IN RED$git commit -m "DESCRIBE THE INTENTION OF THE COMMIT"$git push REMOTE NAME-OF-BRANCHDelete all changes in the Git repository, but leave unstaged things$git checkout .Delete all changes in the Git repository, including untracked files$git clean -fMerge created branch with master branch$git checkout NAME-OF-BRANCH$git merge masterMerge master branch with created branch$git checkout master$git merge NAME-OF-BRANCH

GitLab Installation

官网 https://about.gitlab.com/installation/#ubuntu
文档 https://docs.gitlab.com/ee/README.html

1. Install and configure the necessary dependencies$sudo apt-get install curl openssh-server ca-certificates postfix2. Add the GitLab package server and install the package$curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash$sudo apt-get install gitlab-ceIf you are not comfortable installing the repository through a piped script, you can find the entire script here and select and download the package manually and install using:dpkg -i gitlab-ce-XXX.deb3. Configure and start GitLabsudo gitlab-ctl reconfigure4. Browse to the hostname and loginThe default account's username is root. Provide the password you created earlier and login. After login you can change the username if you wish

GitLab start stop

文档 https://docs.gitlab.com/ee/administration/restart_gitlab.html

Omnibus GitLab restart$sudo service gitlab-ctl status restart stop start$sudo gitlab-ctl restart nginxgitlab-ctl stop unicorngitlab-ctl stop sidekiq$sudo gitlab-ctl kill <service>Reconfigure Omnibus GitLab with:$sudo gitlab-ctl reconfigure

GitLab User Account

文档 https://docs.gitlab.com/ee/ssh/README.html

Before generating a new SSH key pair check if your system already has one at the default location by opening a shell, or Command Prompt on Windows, and running the following command:Windows Command Prompt:$type %userprofile%\.ssh\id_rsa.pubGit Bash on Windows / GNU/Linux / macOS / PowerShell:$cat ~/.ssh/id_rsa.pubGenerating a new SSH key pair$ssh-keygen -t rsa -C "your.email@example.com" -b 4096Note: If you want to change the password of your SSH key pair, you can use$ssh-keygen -p <keyname>.

GitLab server conf

文档

conf in:/etc/gitlab/gitlab.rbinstall in:/var/opt/gitlab/git-data/#grep -v '#' gitlab.rb |grep -v ^$->external_url 'http://192.168.0.62:8081'->gitlab_rails['gitlab_shell_ssh_port'] = 81->nginx['listen_addresses']= ['192.168.0.62']access gitlab from browserhttp://192.168.0.62:8081Username: rootPassword: 5iveL!fe  12345678change password for root:gitlab-rails console production->user = User.where(id: 1).first   or  user = User.find_by(email: 'admin@local.host')->user.password = 'secret_pass'->user.password_confirmation = 'secret_pass'->user.save!--gitlab backup---------0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:createwrite conf /etc/gitlab/gitlab.rb->gitlab_rails['backup_path'] = '/mnt/backups'recovergitlab-rake gitlab:backup:restore BACKUP=1393513186
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 西安市旅游年卡怎么办 广电宽带网速慢怎么办 电视智能卡坏了怎么办 家乐卡二次授信怎么办? 邢台银行倒闭了怎么办 不敢和导师交流怎么办 考上一个破大学怎么办 腻子粉检测报告怎么办 电子厂插件很慢怎么办 预付费电表跳闸怎么办 电费有疑问怎么办大连 农村电表箱坏了怎么办 农村电表没电怎么办 家里电费特别高怎么办 电表读卡失败怎么办 电表卡消磁了怎么办 智能表采集失败怎么办 电脑没有蓝牙功能怎么办 判决后无力偿还怎么办 dz47-63c63跳闸怎么办 租房合同丢了怎么办 北京土地承包合同丢失怎么办 租赁合同丢失了怎么办 房屋租赁合同丢失怎么办 学校没发学生证怎么办 学校银行卡丢了怎么办 报税名字忘了怎么办 地税零申报漏报怎么办 欠中联重科施工电梯钱怎么办 大型船舶起锚正横后怎么办 老师不会教孩子怎么办 个体工商营业证怎么办 广州市住房公积怎么办 苹果账号禁用了怎么办 换单位后公积金怎么办 青岛不发工资怎么办 上北影不会唱歌怎么办 黑驾校不退钱怎么办 驾驶证被扣半年怎么办 买个二手车落户怎么办 名下有公司贷款怎么办