git常用命令

常用命令

  • git add . # 添加所有文件
  • git commit -m "notice message" # 提交更改
  • git push -u origin master # 更新到github
  • git config --list #查看git配置
  • git config --global http.postBuffer 524288000 # 更改缓存
  • git config --global http.lowSpeedLimit 0 # 解决网络延时导致的clone失败
  • git config --global http.lowSpeedTime 999999 # 解决网络延时导致的clone失败
  • git clone --depth=1 http://gitlab.xxx.cn/yyy/zzz.git #浅层clone
  • git fetch --unshallow

一台电脑连接多个github仓库

  • ssh-keygen -t rsa -f ~/.ssh/id_rsa_x -C "[email protected]" # 创建密钥/公钥
  • git remote -v # 查看远程仓库
  • git remote rm origin # 移除远程仓库
  • git remote add origin [email protected]:usrname/repository # 添加远程仓库
  • ssh -T [email protected] # 测试ssh连接
  • ssh-agent bash # 初始化?…
  • ssh-add -D # 清空本地ssh缓存
  • ssh-add id_rsa # 添加ssh密钥到ssh agent

参考资料

  • Windows下Git多账号配置,同一电脑多个ssh-key的管理
  • Git之同一台电脑连接多个远程仓库
  • 一台电脑,两个及多个git账号配置
  • git clone 失败解决

你可能感兴趣的:(工具)