私はgitを学んでいます。私のGithubリポジトリからファイルをプルしようとしています:「関連のない履歴をマージするのを拒否します」
私はGithubで公開リポジトリをいくつか作成しました。今私は現在のコンピュータにローカルのGitリポジトリをセットアップし、いくつかのファイルをコミットしました。
[[email protected] c]# git remote add learnc https://github.com/michaelklachko/Learning-C
成功するように見えた:
[[email protected] c]# git remote show learnc
* remote learnc
Fetch URL: https://github.com/michaelklachko/Learning-C
Push URL: https://github.com/michaelklachko/Learning-C
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (local out of date)
今、私は自分のコンピュータに私のGitHubのレポからファイルをダウンロードしたいそして、私は自分のGithubのページへのリモートポインティングを追加しました。私はこれをしました:
[[email protected] c]# git fetch learnc
[[email protected] c]# git merge learnc/master
warning: refname 'learnc/master' is ambiguous.
Already up-to-date.
しかし、自分のローカルディレクトリに新しいファイルがありません。どうすれば入手できますか?ローカルに私は(他の支店が存在しない)masterブランチによ、ところで
[roo[email protected] c]# git pull learnc master
From https://github.com/michaelklachko/Learning-C
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
:
[[email protected] c]# git status
On branch master
nothing to commit, working directory clean
ローカルリポジトリを設定するときに、Githubリポジトリをクローンしたか、単に 'git init'を実行しましたか?後者の場合、それらのreposは無関係であり(共通のコミットはありません)、それらをマージすることはできません(プルはフェッチ+マージ)。 – Paul
私はinitを行った。私はGithubのレポをクローンしてこれを修正すべきですか? – MichaelSB
Githubレポをクローンして作業を続けることはできますが、依然として別のレポになります。関連性のない2つの履歴をまとめてマージしますか? – Paul