Ubuntu 下安裝: sudo apt-get install git
老一點的Debian或Ubuntu Linux,要把命令改成sudo apt-get install git-core,由於之前有個軟件也叫GIT(GNU Interactive Tools),結果Git就只能叫git-core了。因爲Git名氣實在太大,後來就把GNU Interactive Tools改爲gnuit,git-core正式改成git。jquery
msysgit是Windows版的Git,從http://msysgit.github.io/下載,而後按默認選項安裝便可。linux
安裝完成後,還須要最後一步設置,在命令行輸入:git
$ git config --global user.name "Your Name" $ git config --global user.email "email@example.com"
Git命令github
$ mkdir learngit //新建目錄 $ cd learngit $ pwd //顯示當前目錄 $ git init //建立一個版本庫 $ git add readme.txt //增長文件 $ git commit -m "wrote a readme file" //提交一個版本,-m後面輸入的是本次提交的說明 $ git status //掌握工做區的狀態 $ git diff readme.txt //查看文件的變更 $ git log [--pretty=oneline] //查看歷史記錄 $ git checkout -- file //丟棄工做區的修改時,其本質是用版本庫裏的版本替換工做區的版本 $ git reset --hard HEAD^ [commit id] //HEAD當前版本,HEAD^ 上一個版本,HEAD~N上N個版本,或者到指定commit id的那個版本,另:git reflog用來記錄你的每一次命令,能夠利用它向將來穿梭
docker gitlab 5iveL!fe
http://wiselyman.iteye.com/blog/2179651
https://bitnami.com/docker
自啓動,在/etc/rc.local中添加:
./opt/gitlab-7.6.2-0/ctlscript.sh startapi
https://wiki.bitnami.com/@api/deki/pages/472/pdf
chmod 755 bitnami-gitlab-7.6.2-0-linux.runssh
sudo apt-get install openssh-server
ps -e | grep sshgitlab
解決 Agent admitted failure to sign using the key. 問題
解決方式 使用 ssh-add 指令將私鑰 加進來ui
Git經常使用操做命令收集:url
1) 遠程倉庫相關命令
檢出倉庫:$ git clone git://github.com/jquery/jquery.git
查看遠程倉庫:$ git remote -v
添加遠程倉庫:$ git remote add [name] [url]
刪除遠程倉庫:$ git remote rm [name]
拉取遠程倉庫:$ git pull [remoteName] [localBranchName]
推送遠程倉庫:$ git push [remoteName] [localBranchName]
2)分支(branch)操做相關命令
查看本地分支:$ git branch
查看遠程分支:$ git branch -r
建立本地分支:$ git branch [name] ----注意新分支建立後不會自動切換爲當前分支
切換分支:$ git checkout [name]
建立新分支並當即切換到新分支:$ git checkout -b [name]
刪除分支:$ git branch -d [name] ---- -d選項只能刪除已經參與了合併的分支,對於未有合併的分支是沒法刪除的。若是想強制刪除一個分支,可使用-D選項
合併分支:$ git merge [name] ----將名稱爲[name]的分支與當前分支合併
建立遠程分支(本地分支push到遠程):$ git push origin [name]
刪除遠程分支:$ git push origin :heads/[name]
3)版本(tag)操做相關命令
查看版本:$ git tag
建立版本:$ git tag [name]
刪除版本:$ git tag -d [name]
查看遠程版本:$ git tag -r
建立遠程版本(本地版本push到遠程):$ git push origin [name]
刪除遠程版本:$ git push origin :refs/tags/[name]
4) 子模塊(submodule)相關操做命令
添加子模塊:$ git submodule add [url] [path]
初始化子模塊:$ git submodule init ----只在首次檢出倉庫時運行一次就行
更新子模塊:$ git submodule update ----每次更新或切換分支後都須要運行一下
刪除子模塊:$ git rm --cached [path]
5)忽略一些文件、文件夾不提交
在倉庫根目錄下建立名稱爲「.gitignore」的文件,寫入不須要的文件夾名或文件,每一個元素佔一行便可,如
target
bin
*.db
git clone git@g.zhet.com:hush/UPMS (別人的代碼)一直要求密碼認證,而我已經配置了RSA,苦苦搜索了近兩天,終於在這找到了答案,感謝做者。
http://superuser.com/questions/543626/ssh-permission-denied-on-correct-password-authentication
答案爲第一條:
server sshd_config(/etc/ssh/sshd_config) 1.To enable password authentication, uncomment the following line PasswordAuthentication yes 2.To enable root login, uncomment the following line PermitRootLogin yes 3.To enable ssh key login, un-comment the following line PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys I believe (1) is what you looking for.