从零开始学编程01

开学典礼、git安装及第一次建仓推送

#开学典礼
今天是海同的开学典礼,几位老师上台致词。
#下午自由时间
安装好Ubuntu虚拟机后,注册了优快云以及gitee的账号,原优快云账号ID过于沙雕已经申请注销了。
晚上回来准备试着安装一下GIT,先按照下面的教程来:
https://blog.youkuaiyun.com/huangfukui/article/details/62438839
首先是

#sudo apt-get update

更新到后面会遇到这个问题

W: A error occurred during the signature verification. 
The repository is not updated and the previous index files will be used.GPG error: http://security.
ubuntu.com lucid-security Release: 
The following signatures were invalid: 
BADSIG 40976EAF437D05B5 Ubuntu Archive Automatic Signing Key

这时进行安装git

#sudo apt-get install git

会出问题:git:depends:liberror-perl but it is not installable
发现还是缺少包,就是更新不完全
解决方案

#sudo apt-get clean 
#cd /var/lib/apt 
#sudo mv lists lists.old 
#sudo mkdir -p lists/partial 
#sudo apt-get clean 
#sudo apt-get update

这时再安装就可以成功了

#sudo apt-get install git

发现学校给的Ubuntu已经整合好了GIT
按照码云的教程
https://gitee.com/help/articles/4181#article-header0
生成ssh密钥;


依照教程
https://gitee.com/help/articles/4169
新建仓库;


按照廖雪峰老师的教程,将远程仓库克隆到本地:
https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/001375233990231ac8cf32ef1b24887a5209f83e01cb94b000


按照教程新建文件hello.c并加入到本地仓库
https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013743256916071d599b3aed534aaab22a0db6c4e07fd0000


由于是直接clone下来的,没有fork,所以push失败了。
于是先断开关联:
https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/00150154460073692d151e784de4d718c67ce836f72c7c4000
然后按照
https://www.jianshu.com/p/b011f6769bdf
里的方法,但是fork时显示我是本项目拥有者,不需要fork


删除去了连接的仓库,重新clone gitee的仓库
按照教程
https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000/0013752340242354807e192f02a44359908df8a5643103a000
新建文件lx04.c后

git add lx04.c

添加文件到仓库,然后

git commit -m "注释"

提交到仓库
可以多次add后一次commit

git push origin master

推送到远程
打开码云,发现lx04.c已经添加到仓库

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值