Ubuntu14.04(LTS)gitHub客户端安装
Ubuntu14.04(LTS)gitHub客戶端安裝
使用GitHub步驟:
1、申請GitHub帳戶xxx(申請網址:https://github.com)
2、安裝Git客戶端(Linux)
$sudo apt-get install git
3、生成密鑰對,這樣項目可以push到GitHub上
$ssh-keygen -t rsa -C "xxxx@gmail.com"
4、將.ssh/id_rsa.pub拷貝到GitHub網站
~$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、為了方便,設置ssh不輸入口令
$ eval `ssh-agent`
$ ssh-add
(輸入passphrase)
6、測試是否能聯通GitHub
$ssh git@github.com
如果配置正確,顯示
ERROR:Hi xxx! You've successfully authenticated, but GitHub does notprovide shell access
Connectionto github.com closed.
7、設置Git全局用戶配置
$ git config --global user.name "xxx"
$ git config --global user.email xxx@gmail.com
8、創建本地新項目工作樹
#mkdir new-project
#cd new-project
#git init
#touch README
#git add README
#git commit -m 'first commit'
定義遠程服務器別名origin
# git remote add origin git@github.com:xxx/new-project.git
本地和遠程合并,本地默認分支為master
#git push origin master
GitHub網站上就可以看見了,http://github.com/xxx/new-project
9.更新文件
#vi README
自動commit更改文件
#git commit -a
更新至遠程
#git push origin master
10.創建和合并分支
#gitbranch 顯示當前分支是master
#gitbranch new-feature 創建分支
#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"
合并到遠程服務器
#git push origin new-feature
如果new-feature分支成熟了,覺得有必要合并進master
#git checkout master
#git merge new-feature
#git branch
#git push
則master中也合并了new-feature的代碼
11.Eclipse中操作git(最新eclipse自帶git插件,如果直接用eclipse操作git項目,第8,9,10步驟都可以省略)
(見:http://blog.csdn.net/luckarecs/article/details/7427605)
總結
以上是生活随笔為你收集整理的Ubuntu14.04(LTS)gitHub客户端安装的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: sspanel 常用审计规则
- 下一篇: Ubuntu下修改file descri