报错信息:
在使用git去做K8S证书时常99年的时候,切换分支的时候报错了。
报错原因:
1、第一次接触git,在CSDN上面找了一下解决方法,有的说是本地有更改完还没上传的内容,让给删掉,按照上面执行的操作好像不太行。
2、我就拿着报错信息去百度翻译翻译了一下,提示要将报错的那个文件给隐藏。
3、然后我试了一下,rm -rf 路径不行。
4、这个得去绝对目录下用rm -rf *来删除。
解决方法:
1、切换到报错目录下,一定要使用绝对路径:
[root@k8s-master01 kubernetes]# cd vendor/sigs.k8s.io/kustomize/kyaml/openapi/kubernetesapi/v1_21_2/ [root@k8s-master01 v1_21_2]# ll total 4652 -rw-r--r--. 1 root root 1290217 Mar 29 19:34 swagger.go -rw-r--r--. 1 root root 3469475 Mar 30 16:37 swagger.pb
2、使用rm -rf *,把这两个文件删掉:
[root@k8s-master01 v1_21_2]# rm -rf * [root@k8s-master01 v1_21_2]# ll total 0
3、再次尝试切换分支:
[root@k8s-master01 kubernetes]# git checkout v1.23.17 Checking out files: 100% (17024/17024), done. Note: checking out 'v1.23.17'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b new_branch_name HEAD is now at 953be89... Release commit for Kubernetes v1.23.17
4、没太接触过git,可能是这两个文件占用了,所以删掉就好了。
- 分支 overwritten following checkout changes分支overwritten following checkout overwritten following changes files overwritten following错误changes overwritten following解决方案changes overwritten following changes代码 overwritten following changes local overwritten following changes问题 overwritten following untracked错误 overwritten following untracked working overwritten changes proceed commit