1. 上bitbucket官网注册账号。https://bitbucket.org/。注册时,有一个谷歌验证码,必须用梯子才能刷新出来。然后注册即可。
2. 本地windows安装git。https://git-scm.com/。下载安装包后默认安装。
3. 找到一个目录,右键,git bath here,弹出cmd窗口。
4. 命令窗输入命令。
4.1 配置用户名和邮箱,每次提交时都会在git log中显示。
$ git config --global user.name “github’s Name”
$ git config --global user.email "github@xx.com"
$ git config --list
$ git config --global core.quotepath false(git仓库下中文编码文件名编码成中文,默认不是中文编码)
$ git config --list
4.2 生成校验码。git需要公钥和私钥,私钥存在本地,公钥放在bitbucket服务器,每次提交git会检测这两把钥匙,配对的话才允许你提交到bitbucket。这里我的路径和默认密码都是空,所以输入命令后一路按回车即可。
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/ZCF/.ssh/id_rsa):
Created directory '/c/Users/ZCF/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/ZCF/.ssh/id_rsa.
Your public key has been saved in /c/Users/ZCF/.ssh/id_rsa.pub.
The key fingerprint is:
.....此处是省略...
$
4.3 打开默认路径 /c/Users/ZCF/.ssh/,id_rsa是私钥,不能给人看。id_rsa.pub是公钥,需要记事本打开,复制到网页。
4.4 点击bitbucket个人首页,创建仓库。
4.5 打开仓库,点击clone,复制命令,本地打开文件夹,git bath here,弹出命令窗,输入命令。
$ git clone git@bitbucket.org:xxxx/xxxxxxxxxxx.git
4.6 至此,仓库创建完成,本地可以添加修改各种文件,也可以git push到远程。