Краткое описание ситуации
Я использую Jekyll со страницами GitLab. Я хочу иметь 2 репозитория, один со всеми файлами конфигурации jekyll, а другой только с сгенерированным html, чтобы я мог получить доступ к своей веб-странице на страницах gitlab.
Моя проблема
Я не могу просто клонировать репозиторий, потому что он создает новый подкаталог, и внутри этого каталога я не могу запустить jekyll new .
, потому что он говорит, что в каталоге есть контент.
Хорошо, поэтому я сначала создаю сайт, но затем я хочу синхронизировать этот каталог с удаленным репозиторием на gitlab.
То, что я пытался сделать
vagrant@jekyll:~/mysite$ git remote add origin git@gitlab.com:unveiled_adri/jekyll_config.git
fatal: not a git repository (or any of the parent directories): .git
Это было первое, но говорится, что это не git-репозиторий, поэтому я запускаю этот
vagrant@jekyll:~/mysite$ git init
Initialized empty Git repository in /home/vagrant/mysite/.git/
OkНет проблем. Мы продолжаем ...
vagrant@jekyll:~/mysite$ git add *
The following paths are ignored by one of your .gitignore files:
_site
Use -f if you really want to add them.
vagrant@jekyll:~/mysite$ git commit -m "test"
[master (root-commit) 0498c60] test
Committer: Vagrant Default User <vagrant@jekyll>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:
git config --global --edit
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
9 files changed, 273 insertions(+)
create mode 100644 404.html
create mode 100644 Gemfile
create mode 100644 Gemfile.lock
create mode 100644 _config.yml
create mode 100644 _posts/2019-10-06-welcome-to-jekyll.markdown
create mode 100644 _posts/2019-10-07-Another-awesome-post.markdown
create mode 100644 about.markdown
create mode 100644 first_page.markdown
create mode 100644 index.markdown
Кажется, что все добавляют коммит
vagrant@jekyll:~/mysite$ git remote add origin git@gitlab.com:unveiled_adri/jekyll_config.git
vagrant@jekyll:~/mysite$
Я обнаружил, что эта команда говорит, что добавляет удаленный репозиторий, когда вы не клонировали
vagrant@jekyll:~/mysite$ git push origin master
To gitlab.com:unveiled_adri/jekyll_config.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@gitlab.com:unveiled_adri/jekyll_config.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.
Теперь он говорит, что мне нужно сначала извлечь (я не знаю, что такое извлечение, но я делаю это)
vagrant@jekyll:~/mysite$ git fetch
warning: no common commits
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 14 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (14/14), done.
From gitlab.com:unveiled_adri/jekyll_config
* [new branch] master -> origin/master
Нет проблем с извлечением, я думаю, и теперь я пытаюсь снова нажать на ветку master
vagrant@jekyll:~/mysite$ git push origin master
To gitlab.com:unveiled_adri/jekyll_config.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitlab.com:unveiled_adri/jekyll_config.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.
Он продолжает говорить, что для него требуется извлечение, поэтому сейчас я пытаюсь перенести изменения из ветви master в локальный репозиторий ...
vagrant@jekyll:~/mysite$ git pull origin master
From gitlab.com:unveiled_adri/jekyll_config
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
А теперь это говорит об этом ... Я полностью потерян.
Я раньше использовал только git, но с Visual Studio, поэтому он был графическим, но никогда не использовал git с командами. Я более или менее знаю концепции, поэтому я научился клонировать, выдвигать и извлекать, но с чистым каталогом и хранилищем. Я попробовал сейчас это, но это не так, с существующим каталогом и с существующим хранилищем, и я хочу синхронизировать оба.
Мне действительно не важно содержимое удаленного хранилища, потому что содержимое я хочубудь те, что у меня есть в каталоге сайта jekyll. Так что вы можете предложить решение, которое удаляет удаленные файлы, я не против.
Я много баловался с git, но, как я уже сказал, я действительно потерян и растерян, и я хотел бы понять, чтоэто происходит.
Заранее спасибо