Ubuntu14.04(LTS)gitHub客户端安装
Ubuntu14.04(LTS)gitHub客戶端安裝
使用GitHub步驟:
1、申請(qǐng)GitHub帳戶xxx(申請(qǐng)網(wǎng)址:https://github.com)
2、安裝Git客戶端(Linux)
$sudo apt-get install git
3、生成密鑰對(duì),這樣項(xiàng)目可以push到GitHub上
$ssh-keygen -t rsa -C "xxxx@gmail.com"
4、將.ssh/id_rsa.pub拷貝到GitHub網(wǎng)站
~$ssh-keygen -t rsa -C "xxxx@gmail.com"Generatingpublic/private rsa key pair.
Generatingpublic/private rsa key pair.
Enterfile in which to save the key (/home/tianxingjian/.ssh/id_rsa):
Enterpassphrase (empty for no passphrase):
Entersame passphrase again:
Youridentification has been saved in git_rsa.
Yourpublic key has been saved in git_rsa.pub.
Thekey fingerprint is:
…....
5、為了方便,設(shè)置ssh不輸入口令
$ eval `ssh-agent`
$ ssh-add
(輸入passphrase)
6、測(cè)試是否能聯(lián)通GitHub
$ssh git@github.com
如果配置正確,顯示
ERROR:Hi xxx! You've successfully authenticated, but GitHub does notprovide shell access
Connectionto github.com closed.
7、設(shè)置Git全局用戶配置
$ git config --global user.name "xxx"
$ git config --global user.email xxx@gmail.com
8、創(chuàng)建本地新項(xiàng)目工作樹
#mkdir new-project
#cd new-project
#git init
#touch README
#git add README
#git commit -m 'first commit'
定義遠(yuǎn)程服務(wù)器別名origin
# git remote add origin git@github.com:xxx/new-project.git
本地和遠(yuǎn)程合并,本地默認(rèn)分支為master
#git push origin master
GitHub網(wǎng)站上就可以看見了,http://github.com/xxx/new-project
9.更新文件
#vi README
自動(dòng)commit更改文件
#git commit -a
更新至遠(yuǎn)程
#git push origin master
10.創(chuàng)建和合并分支
#gitbranch 顯示當(dāng)前分支是master
#gitbranch new-feature 創(chuàng)建分支
#git checkout new-feature 切換到新分支
#vi page_cache.inc.php
#git add page_cache.inc.php
Commit到本地GIT
#git commit -a -m "added initial version of page cache"
合并到遠(yuǎn)程服務(wù)器
#git push origin new-feature
如果new-feature分支成熟了,覺得有必要合并進(jìn)master
#git checkout master
#git merge new-feature
#git branch
#git push
則master中也合并了new-feature的代碼
11.Eclipse中操作git(最新eclipse自帶git插件,如果直接用eclipse操作git項(xiàng)目,第8,9,10步驟都可以省略)
(見:http://blog.csdn.net/luckarecs/article/details/7427605)
總結(jié)
以上是生活随笔為你收集整理的Ubuntu14.04(LTS)gitHub客户端安装的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sspanel 常用审计规则
- 下一篇: Ubuntu下修改file descri