因为 github 上仓库里删过一些内容,导致本地的仓库和 github 里的对不上了。
此时用 git push 操作就会报 non-fast-forward
,error: failed to push some refs to
的错误,这也是 git 安全机制的一部分。
所以我们只需要进行下 git pull origin master 就行了,其中 origin 指的是仓库源,master 指的是分支。
git pull origin master 就相当于:
$ git fetch origin master # 从github上抓取代码到本地
$ git merge origin FETCH_HEAD # 与本地代码进行合并
执行过程中会弹出这样一个编辑框,可以用来记录此次调整的改动。
编辑方法如果不会可以看这篇文章:
Linux 技术篇-使用vim命令创建、编辑文件内容实例演示,linux修改文档方法
都做完了,再进行 git add、git commit、git push 操作重新同步就可以了。
强制同步方法:
如果 git push 加个 -f 或 –force 参数可以强制进行同步。
下面是整个操作的完整过程:
小蓝枣+Administrator@С???? MINGW64 /c/Py_jupyter (master)
$ git push -u origin master
To https://github.com/2418546511/Py_jyputer.git/! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://2418546511:xxx@github.com/2418546511/Py_jyputer.git/'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.小蓝枣+Administrator@С???? MINGW64 /c/Py_jupyter (master)
$ git pull origin master
From https://github.com/2418546511/Py_jyputer* branch master -> FETCH_HEAD
Removing Java_Project/untitled1/untitled1.iml
Removing Java_Project/untitled1/.idea/modules.xml
Removing Java_Project/untitled1/.idea/misc.xml
Removing Java_Project/untitled1/.idea/libraries/workbench_workbenchLevel_1.xml
Removing Java_Project/untitled1/.idea/libraries/polardb_jdbc18.xml
Removing Java_Project/untitled1/.idea/.gitignore
Removing Java_Project/test/test.iml
Removing Java_Project/test/src/com/test/test/test.java
Removing Java_Project/test/src/com/test/test/readExcel.java
Removing Java_Project/test/src/com/test/test/SiKuliTest.java
Removing Java_Project/test/src/com/test/test/ReadFile.java
Removing Java_Project/test/src/com/test/test/ReadClipboard.java
Removing Java_Project/test/out/production/test/com/test/test/readExcel.class
Removing Java_Project/test/out/production/test/com/test/test/SiKuliTest.class
Removing Java_Project/test/.idea/modules.xml
Removing Java_Project/test/.idea/misc.xml
Removing Java_Project/test/.idea/compiler.xml
Removing Java_Project/test/.idea/.gitignore
Adding Java_Project/dbmanage/src/com/dbmanage/db/config.txt
Adding Java_Project/dbmanage/src/com/dbmanage/db/ReadFile.java
Adding Java_Project/dbmanage/src/com/dbmanage/db/ReadClipboard.java
Adding Java_Project/dbmanage/src/com/dbmanage/db/DBUpdate.java
Adding Java_Project/dbmanage/src/com/dbmanage/db/DBQuery.java
Adding Java_Project/dbmanage/src/com/dbmanage/db/DBMain.java
Adding Java_Project/dbmanage/src/com/dbmanage/db/DBConn.java
Adding Java_Project/dbmanage/src/META-INF/MANIFEST.MF
Adding Java_Project/dbmanage/out/production/dbmanage/com/dbmanage/db/config.txt
Adding Java_Project/dbmanage/out/production/dbmanage/com/dbmanage/db/ReadFile.class
Adding Java_Project/dbmanage/out/production/dbmanage/com/dbmanage/db/ReadClipboard.class
Adding Java_Project/dbmanage/out/production/dbmanage/com/dbmanage/db/ReadClipboard$Result.class
Adding Java_Project/dbmanage/out/production/dbmanage/com/dbmanage/db/DBUpdate.class
Adding Java_Project/dbmanage/out/production/dbmanage/com/dbmanage/db/DBQuery.class
Adding Java_Project/dbmanage/out/production/dbmanage/com/dbmanage/db/DBMain.class
Adding Java_Project/dbmanage/out/production/dbmanage/com/dbmanage/db/DBConn.class
Adding Java_Project/dbmanage/out/production/dbmanage/META-INF/MANIFEST.MF
Adding Java_Project/dbmanage/out/artifacts/dbmanage_jar/dbmanage.jar
Adding Java_Project/dbmanage/dbmanage.iml
Adding Java_Project/dbmanage/.idea/vcs.xml
Adding Java_Project/dbmanage/.idea/uiDesigner.xml
Adding Java_Project/dbmanage/.idea/modules.xml
Adding Java_Project/dbmanage/.idea/misc.xml
Adding Java_Project/dbmanage/.idea/compiler.xml
Adding Java_Project/dbmanage/.idea/artifacts/dbmanage_jar.xml
Adding Java_Project/dbmanage/.idea/.gitignore
Removing Java_Project/databaseTool/databaseTool.iml
Removing Java_Project/databaseTool/.idea/modules.xml
Removing Java_Project/databaseTool/.idea/misc.xml
Removing Java_Project/databaseTool/.idea/.gitignore
Merge made by the 'recursive' strategy.Java_Project/databaseTool/.idea/.gitignore | 3 -Java_Project/databaseTool/.idea/misc.xml | 6 --Java_Project/databaseTool/.idea/modules.xml | 8 ---Java_Project/databaseTool/databaseTool.iml | 11 ---Java_Project/test/.idea/.gitignore | 3 -Java_Project/test/.idea/compiler.xml | 6 --Java_Project/test/.idea/misc.xml | 6 --Java_Project/test/.idea/modules.xml | 8 ---.../production/test/com/test/test/SiKuliTest.class | Bin 1234 -> 0 bytes.../production/test/com/test/test/readExcel.class | Bin 3730 -> 0 bytes.../test/src/com/test/test/ReadClipboard.java | 63 -----------------Java_Project/test/src/com/test/test/ReadFile.java | 38 -----------.../test/src/com/test/test/SiKuliTest.java | 26 -------Java_Project/test/src/com/test/test/readExcel.java | 76 ---------------------Java_Project/test/src/com/test/test/test.java | 35 ----------Java_Project/test/test.iml | 29 --------Java_Project/untitled1/.idea/.gitignore | 3 -.../untitled1/.idea/libraries/polardb_jdbc18.xml | 9 ---.../.idea/libraries/workbench_workbenchLevel_1.xml | 9 ---Java_Project/untitled1/.idea/misc.xml | 6 --Java_Project/untitled1/.idea/modules.xml | 8 ---Java_Project/untitled1/untitled1.iml | 13 ----22 files changed, 366 deletions(-)delete mode 100644 Java_Project/databaseTool/.idea/.gitignoredelete mode 100644 Java_Project/databaseTool/.idea/misc.xmldelete mode 100644 Java_Project/databaseTool/.idea/modules.xmldelete mode 100644 Java_Project/databaseTool/databaseTool.imldelete mode 100644 Java_Project/test/.idea/.gitignoredelete mode 100644 Java_Project/test/.idea/compiler.xmldelete mode 100644 Java_Project/test/.idea/misc.xmldelete mode 100644 Java_Project/test/.idea/modules.xmldelete mode 100644 Java_Project/test/out/production/test/com/test/test/SiKuliTest.classdelete mode 100644 Java_Project/test/out/production/test/com/test/test/readExcel.classdelete mode 100644 Java_Project/test/src/com/test/test/ReadClipboard.javadelete mode 100644 Java_Project/test/src/com/test/test/ReadFile.javadelete mode 100644 Java_Project/test/src/com/test/test/SiKuliTest.javadelete mode 100644 Java_Project/test/src/com/test/test/readExcel.javadelete mode 100644 Java_Project/test/src/com/test/test/test.javadelete mode 100644 Java_Project/test/test.imldelete mode 100644 Java_Project/untitled1/.idea/.gitignoredelete mode 100644 Java_Project/untitled1/.idea/libraries/polardb_jdbc18.xmldelete mode 100644 Java_Project/untitled1/.idea/libraries/workbench_workbenchLevel_1.xmldelete mode 100644 Java_Project/untitled1/.idea/misc.xmldelete mode 100644 Java_Project/untitled1/.idea/modules.xmldelete mode 100644 Java_Project/untitled1/untitled1.iml小蓝枣+Administrator@С???? MINGW64 /c/Py_jupyter (master)
$ git add Java_Project小蓝枣+Administrator@С???? MINGW64 /c/Py_jupyter (master)
$ git commit -m "update java project 6.30"
[master 37e0f83] update java project 6.303 files changed, 324 insertions(+)create mode 100644 Java_Project/databaseTool/.idea/workspace.xmlcreate mode 100644 Java_Project/test/.idea/workspace.xmlcreate mode 100644 Java_Project/untitled1/.idea/workspace.xml小蓝枣+Administrator@С???? MINGW64 /c/Py_jupyter (master)
$ git push -u origin master
Enumerating objects: 76, done.
Counting objects: 100% (76/76), done.
Delta compression using up to 16 threads
Compressing objects: 100% (50/50), done.
error: RPC failed; curl 55 SSL_write() returned SYSCALL, errno = 10053
fatal: the remote end hung up unexpectedly 88.00 KiB/s
Writing objects: 100% (67/67), 21.22 MiB | 346.00 KiB/s, done.
Total 67 (delta 9), reused 0 (delta 0)
fatal: the remote end hung up unexpectedly
Everything up-to-date
喜欢的点个赞?吧!