1.创建git账号
进入 git 网站 : https://github.com/ 首先创建一个属于自己的 git账号,我的第一个账户名是ahnulplp ,git账号申请好了 之后, 就可以创建仓库(一个仓库一般对应一个项目).
2.创建git仓库
new repository ->
接下来就是 输入 仓库的名字,设置仓库的权限, 填写完之后就点击最后的 Create repository 按钮.
这里我创建了一个 test的仓库用于测试使用.
URL : https://github.com/ahnulplp/test
3.git 客户端
Ubuntu 下
#sudo apt-get install git-core
下载完成后,就可以在终端使用 git了.
4.test仓库下载及常用命令
首先创建一个文件夹用来专门的存放git上的test仓库.
~/GitHub/ahnulplp
#git init
#git clone https://github.com/ahnulplp/test
git clone 仓库URL,即可 拉下 指定的仓库的代码.
接下来就可以编辑test项目中的文件了.
git status 查看哪些文件修改了
git diff XXXX 查看文件内容的修改
git add XXX 添加进git缓冲区
git commit XXX 为这次提交添加注释
git push origin master 将git缓冲区的内容提交到master分支