bitbucket+git使用教學

bitbucket

大家最常使用的版本控制通常是Git+Github,但是Github開私人repo卻要收費,讓我最近開始轉向使用bitbucket,雖然Github比較多人使用,但基本上公開的我才會放Github,私人的都改放Bitbucket,基本上使用方式都一模一樣。
免費註冊Bitbucket後開一個repo,之後安裝git。
git

開啟你的Git後,先告訴他你是誰
git config –global user.email ‘xx@xxx.com’
git config –global user.name ‘xxxxx’

之後在你的本機隨便一個目錄打
git clone https://Username@bitbucket.org/Username/repo-name.git
#repo-name是你剛剛開repo的名稱。

這時git就會把你剛剛開的repo複製一份到local端,不過這時候repo還是空的。
vim test.php #隨便打一些東西
git add test.php
git commit test.php -m ‘first commit’
git push origin master
這時候git就會把你剛剛新增的test.php送上bitbucket了。

所有方法都跟git與github方式一模一樣。可以參考這篇文章