关于git操作
SSH验证
- 验证本地生成的ssh,github或者gitee端密钥是否添加成功,输入如下命令
1 | ssh -T git@github.com |
如果添加成功就会显示如下语句
Hi Username! You’ve successfully authenticated, but GitHub does not provide shell access.
Hi Username! You’ve successfully authenticated, but GITEE.COM does not provide shell access.Username:是你的在git端的名称
同一台电脑上多个github或gitee账户
同一台电脑有两个github账号或者两个gitee账号,配置如下都相同
- 请参考:gitee文档 配置文件如下
1 | # gitee xxxxxx@qq.com |
- 文件中有多个
xxx或aaaaa都是需要修改处,如果需要验证添加SSH是否成功,测试代码如下,对应上面配置文件
1 | ssh -T git@gitee.com |
依此类推有多少个gitee或github就配置多少个,特别注意 xxxx_id_rsa 不能配置为相同文件名。
git 问题
- GitHub Desktop 使用ssh推送或者下拉时候报错 Authentication failed. Some common reasons include:
解决方法:
可以尝试关闭路径 File->Options->Advanced->SSH的选项->Use system OpenSSH 选项
- fatal: unable to access ‘git/‘: Send failure:Connection was reset
解决方法:
为了将来参考,我通过重新打包解决了这个问题:
git repack --max-pack-size=100M -a -d

git指令
git remote 指令
git remote 命令用于用于管理 Git 仓库中的远程仓库。
git remote 命令提供了一些用于查看、添加、重命名和删除远程仓库的功能。
1 | git remote 列出当前仓库中已配置的远程仓库。 |
使用方法:
查看当前的远程仓库URL
1 | git remote -v |
添加远程仓库URL
1 | git remote add master utl(https://xxxxx.git) |