Categories
- FFMpeg (5)
- Libav (1)
- Google (3)
- iBeacon (1)
- LDAP (3)
- Me (2)
- Network (11)
- OS (149)
- RTMP (4)
- SIP (1)
- Kamailio (1)
- SNMP (1)
- VMware (20)
- VCP考試 (1)
- 伺服器 網站服務 (105)
- 名詞解釋 (4)
- 專案管理 (1)
- 工具軟體 (50)
- Adobe (1)
- FMS (1)
- Cloudera (1)
- Docker (1)
- Eclipse (4)
- Intellij (2)
- OBS (2)
- Office (10)
- Excel (4)
- PowerPoint (5)
- Postman (1)
- Splunk (13)
- Virtualbox (2)
- Visual Studio (2)
- 文字編輯器 (10)
- Sublime Text 2 (6)
- Sublime Text 3 (3)
- Vim (3)
- 連線工具 (1)
- Xshell (1)
- Adobe (1)
- 程式語言 (79)
- CSS (2)
- HTML (2)
- iOS (1)
- Java (30)
- JavaScript (5)
- jQuery (4)
- jsTree (2)
- JSP (3)
- PHP (16)
- Python (7)
- Ruby (1)
- sed (1)
- Shell Script (8)
- Windows Bash Script (1)
- XML (1)
- 資料庫 (37)
- FFMpeg (5)
Category Archives: Git
[Git] edit commit message after push
Source: stackopenflow: Changing git commit message after push (given that no one pulled from remote) git comment –amend git push –force
Posted in Git
Leave a comment
[Git] find the file’s latest edited time
Source: stackoverflow: Find when a file was deleted in Git $ git log -1 — o-core/o-service/src/main/java/path/file.java commit 0d5ab0e5d9df7d7b5906ff8db169f43b760daea0 Author: cowman cowman@mitake.com.tw Date: Mon Dec 18 17:58:26 2017 +0800
1 2 |
remove file.java</code> |
Posted in Git
Leave a comment
[Git] remove local git tags that are not in remote
git fetch –prune origin “+refs/tags/:refs/tags/” source: stockoverflow: Remove local tags that are no longer on the remote repository
Posted in Git
Leave a comment
Add git branch name to bash prompt
edit ~/.bash_profile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
if [ -f $(xcode-select -p)/usr/share/git-core/git-completion.bash ]; then . $(xcode-select -p)/usr/share/git-core/git-completion.bash . $(xcode-select -p)/usr/share/git-core/git-prompt.sh fi #enables color in the terminal bash shell export CLICOLOR=1 #sets up the color scheme for list export LSCOLORS=ExFxCxDxBxegedabagacad #sets up the prompt color (currently a green similar to linux terminal) export PS1='\n\[\e[1;30m\]┌─\[\e[0m\]\[\e[01;343m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\n\[\e[1;30m\]└──\[\e[0m\]\$ \[\e[00;33m\]$(__git_ps1 "(%s)")\[\e[00m\]' #enables color for iTerm export TERM=xterm-color |
[Git] List of changed files with another branch
git diff –name-only branchname
Posted in Git
Leave a comment
[Git] Git command…
git stash: 暫存機制 git stash: 暫存機制,可保留目前狀態,重新取回其他版本的code git stash clear: 清除所有暫存空間 git stash drop {git status name}: 清除指定的暫存狀態,如果不加參數,則刪除最近的那一個 git stash list: 查看目前暫存列表 git stash apply {git stash name}: 取回暫存的狀態,如果不加參數,則抓取最近的版本 git stash show {git stash name}: 查看指定的暫存與parent差異的部分,如果不加參數,則顯示最近的那一個版本 git stash branch {git stash … Continue reading
Posted in Git
Leave a comment
git push 失敗
當要push的時候發生了一點錯誤….
1 2 3 4 5 6 7 8 |
[tdg@udnlap01 mail]$ git push -u 20141028 master Enter passphrase for key '/home/tdg/.ssh/id_rsa': To git@cowman.no-ip.org:udn/udn_mail_log.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@cowman.no-ip.org:udn/udn_mail_log.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details. |
查看git status發現沒有問題
1 2 3 |
[tdg@udnlap01 mail]$ git status # On branch master nothing to commit (working directory clean) |
執行rebase重新建立看看
1 2 3 4 |
[tdg@udnlap01 mail]$ git rebase 20141028 cannot rebase: you have unstaged changes U ftp.sh M ftp.sh |
執行stash查看是什麼問題
1 2 3 4 5 6 7 |
[tdg@udnlap01 mail]$ git stash ftp.sh: needs merge ftp.sh: needs merge ftp.sh: unmerged (7800202abc23a0e2d2702afd0e64f8ddec715bdf) ftp.sh: unmerged (0e2f9d79c3e70028002bfa920d47c39b37ddbb9c) fatal: git-write-tree: error building trees Cannot save the current index state |
選擇本低端的版本
1 |
[tdg@udnlap01 mail]$ git checkout --ours ftp.sh |
後面就一般動作推上去了
1 2 3 4 5 6 7 8 9 10 11 12 13 |
[tdg@udnlap01 mail]$ git add ftp.sh [tdg@udnlap01 mail]$ git commit -m "修正mailerd無動作、加入SSH&SCP " [master 76eedce] 修正mailerd無動作、加入SSH&SCP [tdg@udnlap01 mail]$ git push -u 20141028 master Enter passphrase for key '/home/tdg/.ssh/id_rsa': Counting objects: 6, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 1.03 KiB, done. Total 4 (delta 3), reused 0 (delta 0) To git@cowman.no-ip.org:udn/udn_mail_log.git d5b4793..76eedce master -> master Branch master set up to track remote branch master from 20141028. |
Posted in Git
Leave a comment
GitLab – Requirements
Source : Hardware requirements CPU 1 core works supports up to 100 users but the application can be a bit slower due to having all workers and background jobs running on the same core 2 cores is the recommended number … Continue reading
Posted in Git
Leave a comment
Git Server 安裝 (New)
OS: Ubuntu 14.04 Server x64 安裝Gitlab + MySQL + Nginx 系統更新
1 2 3 |
apt-get update apt-get upgrade -y apt-get dist-upgrade |
安裝基本需求
1 2 3 |
# 記得要先裝vim update-alternatives --set editor /usr/bin/vim.basic sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate cmake |
安裝python
1 2 3 4 5 6 7 8 9 10 11 12 |
sudo apt-get install -y python python --version python2 --version # 確認 python版本,如果版本是3.x以上,則需額外安裝2.x版 # sudo apt-get install -y python2.7 # python --version # Python 2.7.3 # python2 --version # 命令執行會採用 python2, 所以需要確認 python2 的版本 # python2 不存在的話, 需要把 python 2.7 版 的 ln 過去. # sudo ln -s /usr/bin/python /usr/bin/python2 apt-get install -y python-docutils |
安裝Git
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# 檢查Git目前可apt安裝的版本 apt-cache showpkg git-core # 如果版本大於1.7.10,則可以直接使用~否則建議手動安裝新版本 # 直接安裝 => apt-get install -y git-core # 如果原本就安裝舊有版本,移除 => apt-get remove git-core # 手動安裝Git apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential cd /tmp curl --progress https://git-core.googlecode.com/files/git-1.9.0.tar.gz | tar xz cd git-1.9.0/ make prefix=/usr/local all make prefix=/usr/local install |
安裝Ruby
1 2 3 4 5 6 7 8 9 10 11 12 |
# 如果裝有1.8版,先行移除 # apt-get remove ruby1.8 mkdir /tmp/ruby && cd /tmp/ruby curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz | tar xz cd ruby-2.0.0-p481/ ./configure --disable-install-rdoc # 下面這行可以用 make 就好 make -j `cat /proc/cpuinfo | grep 'cpu cores' | awk '{if ($4=1) print $4; else print $4-1}'` make install gem install bundler --no-ri --no-rdoc |
新增Gitlab系統帳號
1 |
adduser --disabled-login --gecos 'GitLab' git |
安裝GitLab Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
cd /home/git sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git cd gitlab-shell # 查看最新版本為何 # 或是使用 sudo -u git -H git checkout `sudo -u git -H git describe --abbrev=0 --tags` 自動判斷安裝最新版 sudo -u git -H git tag sudo -u git -H git checkout v2.1.0 sudo -u git -H cp config.yml.example config.yml #修改gitlab_url,改成要使用的domain sudo -u git -H editor config.yml sudo -u git -H ./bin/install |
安裝MySQL Database
1 2 3 4 5 6 7 8 9 |
apt-get install -y mysql-server mysql-client libmysqlclient-dev mysql -u root -p #修改密碼 > CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'GITLAB_PASSWORD'; > CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; >GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; # 使用gitlab帳號測試MySQL sudo -u git -H mysql -u gitlab -p -D gitlabhq_production |
安裝GitLab
1 2 3 4 5 6 7 8 9 10 |
cd /home/git sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab cd /home/git/gitlab # 檢查版本,找stable的 # 或是使用下面自動判斷最新且stable的版本進行安裝 # sudo -u git -H git checkout `sudo -u git -H git branch -a | grep 'stable' | awk 'E ND{print}' | awk 'split($1, version, "/") {print version[3]}'` sudo -u git -H git branch -a sudo -u git -H git checkout 7-0-stable |
設定GitLab
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
cd /home/git/gitlab sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml # 所有 localhost 改成要使用的domain. # /usr/bin/git 改成 /usr/local/bin/git sudo -u git -H editor config/gitlab.yml #調整檔案權限 chown -R git log/ chown -R git tmp/ chmod -R u+rwX log/ chmod -R u+rwX tmp/ sudo -u git -H mkdir /home/git/gitlab-satellites sudo -u git -H mkdir tmp/pids/ sudo -u git -H mkdir tmp/sockets/ chmod -R u+rwX tmp/pids/ chmod -R u+rwX tmp/sockets/ sudo -u git -H mkdir public/uploads chmod -R u+rwX public/uploads sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb chmod -R u+rwX public/uploads sudo -u git -H mkdir public/uploads #如果硬體記憶體規格超過2G,可將worker_processes改成3 #sudo -u git -H editor config/unicorn.rb sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.email "gitlab@localhost" sudo -u git -H git config --global core.autocrlf input |
GitLab DB設計
1 2 3 4 5 6 |
sudo -u git cp config/database.yml.mysql config/database.yml # 將production區塊的secure password值改成MySQL gitlab帳號設定的帳號、密碼 sudo -u git -H editor config/database.yml sudo -u git -H chmod o-rwx config/database.yml |
安裝Gems
1 2 |
cd /home/git/gitlab sudo -u git -H bundle install --deployment --without development test postgres aws |
初始化 Database
1 2 3 4 5 6 |
# 問啥就輸入yes以便建立Database sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production # 取得系統預設帳號、密碼 (所有新安裝都一樣,務必要更改) Administrator account created: login.........admin@local.host password......5iveL!fe |
Posted in Git, Nginx, Ubuntu
Leave a comment
Gitlab改使用GMail SMTP
檢查 config/environments/production.rb 檔案,查看 config.action_mailer.delivery_method = :sendmail 的註解是否已增加,關閉Gitlab sendmail寄送服務 config.action_mailer.delivery_method = :sendmail [註] 使用這一篇 使用GMail SMTP寄信 (Ubuntu) 的方法應該也可以~但是目前會出現 “Mail failure – no recipient addresses” A message that you sent using the -t command line option contained no addresses that were not … Continue reading
Posted in Git, Ubuntu
Leave a comment