Я изучаю Git. Я создал 3 папки e:\temp\repo remote
, e:\temp\repo local 1
и e:\temp\repo local 2
. Я хочу сделать следующие вещи:Выдвижение двух модифицированных и совершенных клонов GIT
В папке e:\temp\repo remote
:
git init --bash
В папке e:\temp\repo local 1
:
git clone "e:\temp\repo remote" "e:\temp\repo local 1"
В папке e:\temp\repo local 2
:
git clone "e:\temp\repo remote" "e:\temp\repo local 2"
Скопируйте файл file1.txt
в e:\temp\repo local 1\dir1
. Скопируйте файл file2.txt
в папку e:\temp\repo local 2\dir2
.
В папке e:\temp\repo local 1
git add *
git commit -m "dir1\file1.txt created"
git push
В папке e:\temp\repo local 2
git add *
git commit -m "dir2\file2.txt created"
Когда я хочу, чтобы подтолкнуть местное 2 репо в удалённой, он выдает следующее сообщение:
To E:\temp\repo remote
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'E:\temp\repo remote'
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."
Я следую инструкциям и вызываю pull in local 2 :
$ git pull
warning: no common commits
remote: Counting objects: 4, done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From E:\temp\repo remote
* [new branch] master -> origin/master
fatal: refusing to merge unrelated histories
Или
$ git pull "e:\temp\repo remote"
From e:\temp\repo remote
* branch HEAD -> FETCH_HEAD
fatal: refusing to merge unrelated histories
Но почему там не связанные между собой истории?
Как объединить изменения второго пользователя в удаленном репо?
Является ли «хозяин» не веткой? –
Да, но пока вы не создадите первую фиксацию, даже эта ветвь на самом деле не существует. Git находится в промежуточном состоянии до тех пор, пока вы не создадите первый фиксатор. – poke
Тогда какие команды следует отправлять перед клонированными? (в удаленном репозитории) –