## centos 換yum為阿里云的源
### 1、備份
`mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup`
### 2、下載新的CentOS-Base.repo 到/etc/yum.repos.d/
#### CentOS 5
`wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo`
`或者`
`curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo`
#### CentOS 6
`wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo`
`或者`
`curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo`
#### CentOS 7
`wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo`
`或者`
`curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo`
### 3、之后運(yùn)行yum makecache生成緩存
## 相關(guān)鏈接
* [官方主頁: http://www.centos.org/](http://www.centos.org/)
* [郵件列表: http://www.centos.org/modules/tinycontent/index.php?id=16](http://www.centos.org/modules/tinycontent/index.php?id=16)
* [論壇: http://www.centos.org/modules/newbb/](http://www.centos.org/modules/newbb/)
* [文檔: http://www.centos.org/docs/](http://www.centos.org/docs/)
* [Wiki: http://wiki.centos.org/](http://wiki.centos.org/)
# 自建git
由于碼云項(xiàng)目出了企業(yè)版 每個(gè)項(xiàng)目成員最多5個(gè)人。
雖然coding允許免費(fèi)5個(gè)私有項(xiàng)目,為了不受限制,我們決定阿里云服務(wù)器上自建git倉庫。
1.安裝
yum install git git-daemon
2. 配置 Git
在 CentOS 中,Git 是以 xinetd 方式提供服務(wù)的,默認(rèn)的 xinetd 配置文件在:/etc/xinetd.d/git。
編輯配置文件,以下是改好的一份 git xinetd 配置文件:
~~~
# default: off
# description: The git d?mon allows git repositories to be exported using \
# ? ? ? the git:// protocol.
service git
{
? ? disable = no
? ? ? ? socket_type ? ? = stream
? ? ? ? wait? ? ? ? ? ? = no
? ? ? ? user? ? ? ? ? ? = nobody
? ? ? ? server? ? ? ? ? = /usr/libexec/git-core/git-daemon
? ? ? ? server_args ? ? = --base-path=/var/lib/git --export-all --user-path=public_git --syslog --inetd --verbose
? ? ? ? log_on_failure? += USERID
}
~~~
接下來啟動(dòng) xinetd 服務(wù):
[root@c1.inanu.net]#
`service xinetd start`
3. 建立 Puppet 服務(wù)器端 Git 倉庫
~~~
[root@c1.inanu.net]#?useradd -d /var/lib/git -s /usr/bin/git-shell git #創(chuàng)建 git 用戶
[root@c1.inanu.net]#?passwd git #設(shè)置 git 用戶密碼
[root@c1.inanu.net]#?chown -R git:git /var/lib/git
[git@c1.inanu.net]$?cd /var/lib/git
[git@c1.inanu.net]$?mkdir .ssh
[git@c1.inanu.net]$?chmod 700 .ssh
[git@c1.inanu.net]$?touch .ssh/authorized_keys
[git@c1.inanu.net]$?chmod 600 .ssh/authorized_keys
[git@c1.inanu.net]$?mkdir /var/lib/git/xx.git #創(chuàng)建 Puppet 服務(wù)器端 Git 倉庫
[git@c1.inanu.net]$?sudo chown -R git:git xx.git
[git@c1.inanu.net]$?cd /var/lib/git/xx.git 注意是否是git的權(quán)限
[git@c1.inanu.net]$?git --bare init #初始化 Puppet 服務(wù)器端 Git 倉庫
~~~
4.客戶端clone
`git clone git@ip:xx/path 全路徑`
已有項(xiàng)目如何遷移
1. 本地clone? 剛建的項(xiàng)目
2. 拷貝本地已有項(xiàng)目所有文件 到這個(gè)目錄后提交
3. 設(shè)置遠(yuǎn)程項(xiàng)目 remote 為新的地址
4. 嘗試更新
更新 賬戶密碼??git git2018
查看遠(yuǎn)程地址
~~~
Git remote -v
git remote set-url origin?ssh://git@116.62.11.197:58585/home/git/ws.git
~~~
無法加入know_hosts?
1. chown?username:?/home/username/.ssh??
2. chown?username:?/home/username/.ssh/*??
3. chmod?700?/home/username/.ssh??
4. chmod?600?/home/username.ssh/*??

- 序
- 前端
- 通用
- bootstrap
- angular
- ui-router
- controller
- react
- 后端
- php
- mysql
- 自定義函數(shù)
- 運(yùn)維
- appveyor ci構(gòu)建php擴(kuò)展
- api
- weixin
- geo
- 西陸整理
- 人員
- 目錄結(jié)構(gòu)
- 數(shù)據(jù)庫結(jié)構(gòu)
- 項(xiàng)目初始化
- 小記憶
- 分頁函數(shù)
- 系統(tǒng)函數(shù)庫
- 常用函數(shù)庫
- 操作數(shù)據(jù)庫
- 幫助演示
- ct高級(jí)搜索
- 測試代碼極客tags
- 服務(wù)器
- java
- yar
- 簡歷
- tcp
- efi分區(qū)加載
- 氧庫測試
- 測試
- pgsql
- 轉(zhuǎn)換
