使用Git遇到的问题(持续更新中)
1、同步远程仓库时失败
使用命令: git push -u origin master
##出现如下错误
$ git push -u origin master
To gitee.com:hot_heart/billing_management_system.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitee.com:hot_heart/billing_management_system.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.
原因是:远程repository和我本地的repository冲突导致,在创建的远程仓库的时候,勾选了使用Readme文件初始化这个仓库,而实际并没有pull下来
解决办法,输入如下命令:
$ git pull --rebase origin master
2、通过TortoiseGit做push时错误提示
Disconnected: No supported authentication methods available
(server sent: publickey)
在GitBash命令行中没有错误,怀疑是TortoiseGit的配置问题
第一步是配置ssh客户端
第二步是配置origin
点击完成完成就可以正常push了。
注意:push到不同远程仓库须修改URL