avatar

目录
Git提交代码到远程仓库

Git提交代码到远程仓库

1、初始化为git仓库

git init 

2、添加所有要提交的文件

git add .

3、本次提交说明

git commit -m '提交说明'

4、关联GitHub远程仓库

git remote add origin 仓库地址(没有添加ssh key建议使用 https地址)

5、获取远程仓库最新代码

git pull origin master

6、推送本次提交到仓库

git push origin master

注意:! [rejected] master -> master (non-fast-forward) 头指针报错解决:

操作步骤:

git pull origin master --allow-unrelated-histories

git add .

git commit -m '提交说明'

git push origin master
文章作者: HJY
文章链接: https://hjy-dev.github.io/2020/03/02/git%E6%8F%90%E4%BA%A4%E4%BB%A3%E7%A0%81%E5%88%B0%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93/
版权声明: 本博客所有文章除特别声明外,均采用 Apache License 2.0 许可协议。转载请注明来自 Kiven Blog
打赏
  • 微信
    微信
  • 支付寶
    支付寶

评论