初识 git 上传代码到github 掉坑里了哦

想把暑假没做完的地铁网络售票系统上传到github 本以为花个几分钟就好了 没想到弄了那么长时间 实在是不应该啊 下面说说我的遭遇


上传代码到github方法:

  用github的客户端(GUI 易操作 )
  用git上传


也是在git上传时候遇到的坑

步骤:

详细步骤:http://blog.youkuaiyun.com/fanfan4569/article/details/52824800
$ git init
$ ssh-keygen -t rsa -C “your_email@youremail.com”
$ ssh -T git@github.com
$ git config –global user.name “your name”
$ git config –global user.email “your_email@youremail.com”
$ git remote add origin git@github.com:yourName/yourRepo.git
$ git add XXX
$ git commit -m “first commit”
$ git push origin master

遭遇点①:

error:[git] warning: LF will be replaced by CRLF

解决办法:

在git bash 输入下面的命令:

git config –global core.autocrlf false(2个’-‘)

删掉项目中的.git文件夹 $ rm -rf .git

重新

git init 再 git add XXX

遭遇点②:

由于我多次push 又 remove git 又 新建 导致版本更新不同(。。。
error : updates were rejected because the tip of your current branch is behind its remote counterpart
然后我找了很多 但都不行 最后强制push
$ git push -u origin master
详细解答:http://blog.youkuaiyun.com/fanfan4569/article/details/52824975


有待学习。。。

命令行:
$ git remote show origin 查看某个远程仓库的详细信息
$ git remote rm origin 删除远程仓库地址
$ git remote add origin [url] 添加远程仓库地址
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值