默认已配置好SSH Keys
1、在GitHub上创建好项目
2、将代码克隆到本地
git clone https://github.com/xxxxxxx/xxxxx.git
克隆私有仓库
git clone git@github.com:xxxxx/xxxxx.git
- 第一个xxxx是GitHub用户名
- 第二个xxxx是仓库名
3、编辑项目
4、将改动添加到暂存区
git add .
5、输入描述
git commit -m "提交说明"
6、将本地更改推送到远程master分支
git push origin main
关于push报错
报错信息
To github.com:XXX/XXX.git
! [rejected] main -> main (fetch first)
error: failed to push some refs to 'github.com:XXX/XXX.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
解决
- 输入
git pull
该解决方法适用于本人,仅供参考
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/114866.html