git有两种推送方式,https和ssh,使用ssh前需要在本地配置秘钥,这篇文章 有讲

具体选择何种推送方式只需要在绑定远程仓库时按格式配置仓库的url

例如

1
2
# 以https的方式绑定远程仓库
$ git remote add origin https://github.com/btkrc/desktop.git/
1
2
3
4
5
6
# 使用ssh绑定远程仓库
$ git remote add origin git@github.com:btkrc/desktop.git
$ git pull git@github.com:btkrc/desktop.git --rebase
$ git add .
$ git commit -m "..."
$ git push --set-upstream origin <本地仓库>

在国内使用https推送容易超时,建议使用ssh