git 项目 保存至gitee中
Posted yupixiu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git 项目 保存至gitee中相关的知识,希望对你有一定的参考价值。
输入个人信息(代码提交者)
git config --global user.name "xxxx"
git config --global user.email [email protected]
初始化项目
git init
设置远程地址
git remote add origin https://github.com/xxxxxxxx
git push origin master //报错
执行命令:
git pull origin master --allow-unrelated-histories
git 在pull或者合并分支的时候有时会遇到这个界面。可以不管(直接下面3,4步),如果要输入解释的话就需要:
1.按键盘字母 i 进入insert模式
2.修改最上面那行黄色合并信息,可以不修改
3.按键盘左上角"Esc"
4.输入":wq",注意是冒号+wq,按回车键即可
之后就可以成功的pull,push了
提交到远程报错,如下:
src refspec master does not match any
原因:
本地仓库为空
解决方法:使用如下命令 添加文件;
$ git add add.php addok.php conn.php del.php edit.php editok.php ftpsql.sql index.php
$ git commit -m "init files"
之后在push过程中出现如下错误:
$ git push -u origin master
Warning: Permanently added the RSA host key for IP address ‘xx.xx.xxx.xxx‘ to the list of known hosts.
To [email protected]:hahaha/ftpmanage.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘[email protected]:hahahah/ftpmanage.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 之后在 push
使用如下命令解决:
$ git pull --rebase origin master
warning: no common commits
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:hahah/ftpmanage
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
First, rewinding head to replay your work on top of it...
Applying: init files
继续push,成功。
---------------------
作者:sclibingqing
来源:CSDN
原文:https://blog.csdn.net/sclibingqing/article/details/81179470
版权声明:本文为博主原创文章,转载请附上博文链接!
以上是关于git 项目 保存至gitee中的主要内容,如果未能解决你的问题,请参考以下文章