git------将本地项目推送到远程空仓库

更新时间:2023-06-18 06:26:35 阅读: 评论:0

git------将本地项⽬推送到远程空仓库番外:基础配置
//1.配置全局的git仓库的 ⽤户名 和 邮箱
git config --global ur.name '仓库的账号名'
git config --ail '绑定的邮箱'
第⼀步:建⽴远程仓库(码云、GitHub等)
第⼆步:进⼊到对应的项⽬⽂件夹根⽬录中:
git init  //⽣成.git⽂件
3、将本地和远程⼚库关联起来
git remote add origin 远程仓库地址
4、将本地代码推送到库上
git add .
关于感恩git commit -m '提交信息' -n
git push -u origin master  //第⼀次初始化仓库时:-u 之后不⽤
5.在第四步时可能会报错:
最青春小说! [rejected]        master -> master (fetch first)
error: failed to push some refs to '/all-ko/react.git'
hint: Updates were rejected becau the remote contains work that you do
hint: not have locally. This is usually caud 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.
原因:是因为github中的README.md⽂件不在本地代码⽬录中,可以通过如下命令进⾏代码合并
git pull --reba origin master
//之后重复第四步最后的命令:
git push -u origin master
出现这样的代码,即为拉取readme成功:
$ git pull --reba origin master
warning: no common commits
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reud 0 (delta 0)
Unpacking objects: 100% (4/4), done.
* branch            master    -> FETCH_HEAD青年寄语
* [new branch]      master    -> origin/master
First, rewinding head to replay your work on top Applying: ⾸次提交紫砂壶泡茶
接着运⾏:
git push -u origin master
出现这样的代码,本地项⽬推到远程即告⼀段落^_^:
聚同
$ git push -u origin master
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 8 threads
Compressing objects: 100% (14/14), done.二年级绘画作品
Writing objects: 100% (16/16), 74.71 KiB | 1.36 MiB/s, done. Total 16 (delta 0), reud 0 (delta 0)
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
6.最后运⾏代码:
git push origin master //注意此刻推得分⽀即为想要将⽂件放的分⽀另外::::
上⾯报错:
git push --t-upstream origin master
Administrator@WIN-QTM6B4FMB6V MINGW64 /d/前端项⽬/webstromfiles/huaanwares (master)元日的古诗
$ git push --t-upstream origin master
! [rejected]        master -> master (fetch first)
error: failed to push some refs to '/all-ko/huaan_statistical_software.git'
hint: Updates were rejected becau the remote contains work that you do
hint: not have locally. This is usually caud 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 push --t-upstream origin master -f吃什么瘦肚子
Administrator@WIN-QTM6B4FMB6V MINGW64 /d/前端项⽬/webstromfiles/huaanwares (master)
$ git push --t-upstream origin master -f
Enumerating objects: 69, done.
Counting objects: 100% (69/69), done.
Delta compression using up to 4 threads
Compressing objects: 100% (59/59), done.
Writing objects: 100% (69/69), 405.77 KiB | 7.38 MiB/s, done.
Total 69 (delta 0), reud 0 (delta 0)
remote: Powered by GITEE [GNK-3.8]
+ 4b29d58 master -> master (forced update)
Branch 'master' t up to track remote branch 'master' from 'origin'.
————————————————
版权声明:本⽂为CSDN博主「绝世唐门三哥」的原创⽂章,遵循CC 4.0 BY-SA版权协议,转载请附上原⽂出处链接及本声明。

本文发布于:2023-06-18 06:26:35,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/981264.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:仓库   远程   代码
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图