Git+码云的安装与使用记录

一、安装Git

安装步骤参考:

Git 详细安装教程(详解 Git 安装过程的每一个步骤)mukes的博客-CSDN博客git安装

二、Git + 码云的使用

入门教程参考:

git + 码云 使用详解(入门)(mac+windows教程)ai1362425349的博客-CSDN博客git码云使用教程

三、添加文件步骤

文件路径中右键“Git Bash Here”,运行:

 $ git add .
 $ git commit -m ''
 $ git push origin master

四、问题记录

1、问题:输入命令“git add .”后报错

 $ git add .
 error: 'xxx/' does not have a commit checked out
 fatal: adding files failed

解决方法:删除 xxx/文件夹下的 .git 隐藏文件

2、问题:输入命令“git add .”后警告

 warning: LF will be replaced by CRLF in ball_pool/assets/Main.js.
 The file will have its original line endings in your working directory

解决方法:发生的原因是路径中存在 / 的符号转义问题,false就是不转换符号默认是true,相当于把路径的 / 符号进行转义,这样添加的时候就有问题。这个提示的意思是说会把windows格式(CRLF,即回车换行)转换成Unix格式(LF),git默认支持LF。这些警告不影响使用。

可运行如下代码解决该问题:

  git config --global core.autocrlf false

3、问题:输入命令“git push origin master”后报错

 $ git push origin master
 To gitee.com:xxx.git
  ! [rejected]        master -> master (non-fast-forward)
 error: failed to push some refs to 'gitee.com:xxx.git'
 hint: Updates were rejected because the tip of your current branch is behind
 hint: its remote counterpart. Integrate the remote changes (e.g.
 hint: 'git pull ...') before pushing again.
 hint: See the 'Note about fast-forwards' in 'git push --help' for details.

解决方法:可能gitee中某些文件被删掉不在本地代码目录中,故先使用“git pull --rebase origin master”拉取线上仓库,再使用git add ,git commit,git push

 $ git pull --rebase origin master
 From gitee.com:xxx
 branch            master     -> FETCH_HEAD
 Successfully rebased and updated refs/heads/master.

再输入“git push origin master”后成功上传。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值