Github到了一个工作区里面。嵌套了

Andrew代码战士 2020-04-20

MINGW64 /f/Git (master)
$ git remote add origin :Captain-Soap/fromF.git
fatal: remote origin already exists.

MINGW64 /f/Git (master)-----------------------------此问题笔记和收藏里面提到过
$ git remote rm origin

MINGW64 /f/Git (master)
$ git remote add origin :Captain-Soap/fromF.git

MINGW64 /f/Git (master)
$ git push -u origin master
To github.com:Captain-Soap/fromF.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘:Captain-Soap/fromF.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.

MINGW64 /f/Git (master)----------------------------〉可见一定要写准确啊
$ git pull -rebase origin master
error: Invalid value for --rebase: ebase

MINGW64 /f/Git (master) --------------------------〉同上
$ git pull - rebase origin master
fatal: strange pathname ‘-‘ blocked

MINGW64 /f/Git (master)
$ git pull --rebase origin master                                              ---------------------------〉将远程库中的多的那个readme给pull到本地代码中,之后我们才能push
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 593 bytes | 0 bytes/s, done.
From github.com:Captain-Soap/fromF
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
Successfully rebased and updated refs/heads/master.

MINGW64 /f/Git (master)
$ git push -u origin master
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 307 bytes | 307.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:Captain-Soap/fromF.git
a029478..8985a28 master -> master
Branch ‘master‘ set up to track remote branch ‘master‘ from ‘origin‘.

Github到了一个工作区里面。嵌套了

MINGW64 /f/Git (master)
$ git status
On branch master
Your branch is up to date with ‘origin/master‘.

Untracked files:
(use "git add <file>..." to include in what will be committed)
test/                                                                    --------------------------------------------------------------〉test里面同样有一个README而已(显然这个是github克隆到本地的东西)

nothing added to commit but untracked files present (use "git add" to track)

MINGW64 /f/Git (master)
$ git add test                                                       ------------------------------------------------------------〉因为上面说她没有被track
warning: adding embedded git repository: test
hint: You‘ve added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:                                                                               这个可见这篇https://www.cnblogs.com/lsgxeva/p/8540758.html云水的博文
hint:
hint: git submodule add <url> test
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached test
hint:
hint: See "git help submodule" for more information.

现在Github里面是这样一个情况:(当然fromF中有了a.txt)

Github到了一个工作区里面。嵌套了

现在是这样一个情况:

我把github里的test克隆到本地了,想把这个工作区的test给弄到版本库和本地分支中(weird iead)

as you can see

You‘ve added another git repository inside your current repository.       我的Git是一个repository,那么这个从github pull过来的,也是我亲手点的new repository,库中库

你仔细翻译就懂了

克隆外面这个库(Git),将不会包含里面这个库(test)(但我git add是里面的啊,还是说一个库不用add?)

是的,test等同于你这个Git工作区

这里有有一篇https://blog.csdn.net/qq_35082030/article/details/74893853说明了这个文件与版本库中不一致,所以只有强制删除。

这里有个老外也和我遇到了相同的问题

Github到了一个工作区里面。嵌套了galath也说了

Github到了一个工作区里面。嵌套了

但是我还是不懂这个是不是和树有关系???迷茫啊,以后会懂得是吧?

而且我也是跟着问题跑,aimless,慢慢来吧!

加油小白。

相关推荐