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版权协议,转载请附上原⽂出处链接及本声明。