git处理时的问题

 1. 在node.js开发的时候常常会遇到从别人的远程仓库中clone时出现文件名过长的错误,

或则是在本地npm下载之后的文件进行上传到自己的远程仓库的时候会出现 File too long的情况,这个时候(例如:mongoose的模块,less模块)

可以在git bash中先运行下面这行命令:

     git config --global core.longpaths true,

这样基本上可以解决问题。

 

  2. 如果对于非必要处理的文件文件可以利用.gitignore文件来忽略文件的上传到git远程仓库,

    具体介绍谷一下就行了,或则找一下度娘就解决。

 

  3. npm下载或遇到下载不下来的时候可以考虑淘宝镜像cnpm

    npm install -g cnpm --registry=https://registry.npm.taobao.org

  4. git提交的时候出现这种错误的时候:

  “If no other git process is currently running, this probably means a
  git process crashed in this repository earlier. Make sure no other git
  process is running and remove the file manually to continue.”

  解决方法:
    git bash 中输入:
rm -f ./.git/index.lock

 5.git push 或者是 git pull 的时候出现下面报错

    Could not read from remote repository.

    Please make sure you have the correct access rights.and the repository exists.

    出现这个问题可能是因为,没有在github账号添加SSH key,或是因为重装系统等原因导致密钥与公钥丢失。需重新创建密钥与公钥

   解决方法:

      打开git bash(不可以是windows系统的cmd命令行):  ssh-keygen -t rsa -C "your_email@xxx.com"

      之后创建的三个回车,

      创建好后会默认在系统盘中创建一个公钥文件一般情况在 C:\Users\主机名\.ssh 文件夹下有一个这个 id_rsa.pub 文件
      用记事本或者文本编辑器打开选中里面的所有内容  或者  命令行输入 pbcopy < ~/.ssh/id_rsa.pub 直接复制到剪切板上

      然后到自己的github中设置中添加SSH keys 





posted @ 2015-12-14 16:40  xinqeeli  阅读(236)  评论(0编辑  收藏  举报