您的位置:首页 > 编程语言

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

2016-10-15 20:23 351 查看

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

上传代码到github方法:

  ①用github的客户端(GUI 易操作 )

  ②用git上传

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

步骤:

详细步骤:http://blog.csdn.net/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.csdn.net/fanfan4569/article/details/52824975

有待学习。。。

命令行:

$ git remote show origin 查看某个远程仓库的详细信息

$ git remote rm origin 删除远程仓库地址

$ git remote add origin [url] 添加远程仓库地址

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git