Github入门(三)实现一个小例子

本文详细介绍了如何在GitHub上创建和管理仓库的过程,包括设置仓库信息、克隆仓库到本地、提交文件更改并推送到远程仓库等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值