作为一名代码渣,虽然代码写得很烂,但多多少少也写了些了。听说大牛们都在用Bitbucket,瞻仰代码时却连git clone都不会也有点说不过去了,因此,我要入门!
参考:http://blog.jobbole.com/53573/ (中文)
https://confluence.atlassian.com/bitbucket/bitbucket-cloud-documentation-home-221448814.html(英文)
1、安装git https://git-scm.com/
2、注册用户并创建一个仓库 https://bitbucket.org
3、设置git
git config --global user.name "your_username"
git config --global user.email your_email@domain.com
git config --global push.default simple
4、创建本地代码库
在工程文件夹内,右键git bash here,弹出命令行模式
git init
创建一个名为.git的隐藏文件夹,那就是本地代码库。
5、加载文件
git add .
“.”代表根目录下的所有文件,也可以指定某个文件。
6.提交文件
git commit -m “first try”
提交并注释
7、上传至远程代码库
添加远程代码库
git remote add origin https://your_username@bitbucket.org/your_username/name_of_remote_repository.git
origin是代码库的别名,可以自己规定。
git push origin master
推送。