window端GitHub托管代码

一些前期配置见博客 点击打开链接
1、下载GitHub的bash和Windows desk版本,在用户目录下生成自己的公钥.pub
cd ~
ssh-keygen -t rsa 
一直enter
2、把用户公钥粘贴GitHub网站的ssh key那,下次免密上传
3
第一次进入时:echo "# f2fsCode" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:xixiss/f2fsCode.git
git push -u origin master

以后每次提交:
git add 文件名
git commit -m "修改描述"
git push
4、git的客户端和网页端都能查看最近的更改。客户端还能回滚

使用遇到的问题
$ git push
To github.com:xixiss/f2fsCode.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:xixiss/f2fsCode.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
这是因为local版本和远端版本不一致造成的(不一致的原因是再客户端和bash两个地方同时更改,造成了版本不一致),需要同过git pull 操作,拉取远程代码,使得版本同步,才能继续push


所以在协同操作时,每次操作要确保自己写的local版本与remote版本一致:写之前先pull一次!!!!
这样,每次编辑之前,都是最新版本,协同操作也变成了版本的迭代,就像一个人在一直提交一样(一个人不用pull的原因是,每次他写好的代码,push上去之后,没有别人去改,于是本地和远端代码一直一致,因此不用pull)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值