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

来源:互联网 发布:b2b 知乎 编辑:程序博客网 时间:2024/05/22 20:28

想把暑假没做完的地铁网络售票系统上传到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] 添加远程仓库地址

1 0