1.在github中新建一个仓库
2.设置相关信息
其中:
Description栏中可以设置仓库的说明,可不填写;
Public和Private指选择公共还是私有(私有7美元一个月)
Initialize this repository with a README,勾上此选项,随后GitHub会自己初始化仓库并设置README文件,让用户可以立即clone这个仓库到本地电脑。
最后点击Create repository 即可!
3.克隆该仓库到本地
~/test$ git clone https://github.com/test0410/hello.git
Cloning into 'hello'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
Checking connectivity... done.
其中克隆地址可以在此复制
克隆成功之后便能在test文件夹中看到hello这个仓库。
注:克隆到哪个文件夹取决于你在哪个目录下使用上面的克隆命令
4.实现一个小例子
a.任意新建一个文件
b.在该目录下打开终端
~/test/hello$ git add test
~/test/hello$ git commit -m "add test" //引号中的是任意描述
[master 28ef8fe] add test
1 file changed, 1 insertion(+)
create mode 100644 test
//通过git add命令将文件加入暂存区,再通过git commit命令提交。此时就可以通过git log来查看提交日志
c.push到github上去
~/test/hello$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
...............
Username for 'https://github.com': test0410//输入github用户名
Password for 'https://test0410@github.com': //注册igthub时的密码
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 282 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/test0410/hello.git
fc69a98..28ef8fe master -> master
*****根据GitHub入门与实践整理*****
Github入门(一)注册Github账号 http://blog.youkuaiyun.com/the_lastest/article/details/70001156
Github入门(二)安装Git及配置 http://blog.youkuaiyun.com/the_lastest/article/details/70022416
Github入门(三)实现一个小例子 http://blog.youkuaiyun.com/the_lastest/article/details/70036646
Github 删除远程仓库中的文件 http://blog.youkuaiyun.com/the_lastest/article/details/70038012