| この記事の要点 |
|---|
|
エラーの状況
$ git pull
現在のブランチはプル用に構成されていません。
変更を統合するためには、以下を行ってください
git pull <リモート> <ブランチ>
さもなければ
git branch --set-upstream-to=<リモート>/<ブランチ> <ブランチ>
# 英語版
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> <branch>
原因
git pull は「現在のブランチに対応するリモートブランチ」(upstream / tracking branch) から fetch + merge します。upstream が設定されていないと「どのリモートブランチを pull するか」が分からずエラーになります。
upstream 設定の確認
# 現在の upstream
$ git branch -vv
* feature/login abc1234 [origin/feature/login] commit message
main def5678 [origin/main] another commit
local-only ghi9012 ← upstream なし
# git remote 設定
$ git remote -v
origin git@github.com:user/repo.git (fetch)
origin git@github.com:user/repo.git (push)
対処方法
方法 1: upstream を後から設定(推奨)
# 現在のブランチに upstream 設定
$ git branch --set-upstream-to=origin/main main
branch 'main' set up to track 'origin/main'.
# 短縮形
$ git branch -u origin/main
# 確認
$ git branch -vv
* main abc1234 [origin/main] commit message
# 以後は普通に pull
$ git pull
方法 2: pull 時にリモートとブランチを明示
$ git pull origin main
# remote = origin, branch = main を明示
# 短縮 (1 回だけならこれで OK)
# 毎回打つのは面倒 → upstream 設定を推奨
方法 3: push 時に -u で upstream 自動設定
# 新規ブランチを push しつつ upstream 設定
$ git push -u origin feature/new-feature
# = git push origin feature/new-feature + git branch -u origin/feature/new-feature
# 以後は普通に push / pull できる
$ git push
$ git pull
方法 4: グローバル設定で自動 upstream(推奨)
# 新規ブランチを push する時、自動的に upstream 設定
$ git config --global push.autoSetupRemote true
# 以後は push で -u 不要
$ git checkout -b new-feature
$ git push # → 自動的に origin/new-feature 作成 + upstream 設定
# Git 2.37+ で利用可能
状況別の対応
シナリオ 1: ローカルだけのブランチをリモートにプッシュ
# ローカルで作ったブランチ
$ git checkout -b feature/dashboard
# コミット
$ git add .
$ git commit -m "add dashboard"
# 初回 push (upstream 設定)
$ git push -u origin feature/dashboard
# 以後は普通に
$ git push
$ git pull
シナリオ 2: クローン直後で upstream 設定が消えた
# clone なら upstream は自動設定されているはず
$ git clone https://github.com/user/repo.git
$ cd repo
$ git pull # → OK
# それでもエラーなら fetch 確認
$ git fetch origin
$ git branch -r # リモートブランチ一覧
$ git branch --set-upstream-to=origin/main main
シナリオ 3: ローカルとリモートで名前が違うブランチ
# ローカル: feature/login
# リモート: features/login (s 違い)
# 明示的にマッピング
$ git branch --set-upstream-to=origin/features/login feature/login
# または fetch + checkout
$ git fetch origin features/login:feature/login
シナリオ 4: 別リポジトリの fork から pull
# 自分の fork: origin
# 元リポジトリ: upstream として追加
$ git remote add upstream https://github.com/original/repo.git
# upstream から pull
$ git fetch upstream
$ git merge upstream/main
# または直接
$ git pull upstream main
関連 git config 設定
# 新規ブランチに自動 upstream
$ git config --global push.autoSetupRemote true
# pull のデフォルト動作 (merge / rebase)
$ git config --global pull.rebase false # merge (デフォルト)
$ git config --global pull.rebase true # rebase
$ git config --global pull.ff only # fast-forward only
# branch.autoSetupMerge (新規ブランチ作成時)
$ git config --global branch.autoSetupMerge always
# true (デフォルト): リモートから派生したブランチのみ自動 tracking
# always: ローカル間でも自動 tracking
# false: 自動 tracking なし
# 設定確認
$ git config --list | grep -E "push|pull|branch"
upstream / tracking branch の概念
# upstream = 「このローカルブランチが追従するリモートブランチ」
# 設定済みの利点:
# - git pull / git push に引数不要
# - git status で「ahead of origin/main by 3 commits」と表示
# - git fetch でリモートの最新を取り込みやすい
# 確認コマンド
$ git config branch.main.remote # → origin
$ git config branch.main.merge # → refs/heads/main
# 削除
$ git branch --unset-upstream
# またはコンフィグから
$ git config --unset branch.main.remote
$ git config --unset branch.main.merge
関連エラー
| エラー | 意味 |
|---|---|
current branch has no tracking branch | このページ |
The current branch master has no upstream branch | push 時の同種エラー |
fatal: not a git repository | git 管理外 |
fatal: refusing to merge unrelated histories | 履歴非共通 |
関連記事
- git
- Cannot rebase: You have unstaged changes
- git rm [-r --cached] の取り消し
- error: pathspec did not match (git)
子ページ
子ページはありません
同階層のページ
- モジュール名が無効です。(WAR エクスポート)
- 現在のブランチはプル用に構成されていません 構成にキー remote.origin.url の値がありません
- サーバーに追加または除去できるリソースがありません。
- invalid LOC header (bad signature)
人気ページ
- 1 Eclipseで「サーバーに追加または除去できるリソースがありません。」の原因と対処法
- 2 tomcat の起動 / 停止ログと catalina.log・catalina.out の違い
- 3 JavaScript で base URL を取得する方法|window.location.origin
- 4 YouTube Data API v3 エラー一覧|403・400・404 の原因と対処
- 5 Laravel エラー一覧|500/Blade/DB 接続/ルーティングの代表エラー
- 6 3Dグラフィックスのソフト一覧|Blender・Metasequoiaと用途別の選び方
- 7 Spring Frameworkのアノテーション一覧
- 8 【Spring】@Valueアノテーションとは
- 9 CATALINA_HOME の確認方法 (Linux / Mac)
- 10 【Spring】@Autowiredアノテーションとは
最近更新/作成されたページ
- Visual Studio「デザイナーを表示できません」エラーの原因と対処 2026-10-28 12:06:00
- SSH 認証に失敗しました。再試行してください の対処 2026-10-28 12:06:00
- SSH2 秘密鍵の読み込みに失敗しました の原因と対処 2026-10-28 12:06:00
- TeraTerm のよくあるエラーと対処法完全ガイド — Connection refused / 2026-10-28 12:06:00
- Visual Studio エラー一覧|コンパイルエラー・警告の確認方法と対処 2026-10-28 11:39:57
- Whitelabel Error Page の原因と消し方|Spring Boot のエラーページ 2026-10-28 11:39:57
- Eclipseで「サーバーに追加または除去できるリソースがありません。」の原因と対処法 2026-10-28 11:39:57
- SQL WHERE 句完全ガイド 2026-10-28 11:39:57
- SQL JOIN 完全ガイド (INNER/LEFT/RIGHT/FULL OUTER) 2026-10-28 11:39:57
- tomcat の起動 / 停止ログと catalina.log・catalina.out の違い 2026-10-28 10:24:23
- Tomcat の起動確認方法 5 つ|localhost:8080・ポート・プロセス・ログ 2026-10-28 10:24:23
- Oracle 19c COMMITの使い方: 暗黙コミット・自動確定・応答不明時の確認 2026-10-28 09:59:09
- Oracle 19c DELETE文|削除対象の確認・COMMIT前の判断・ROLLBACKの条件 2026-10-28 09:59:09
- Oracle 19c INSERT文|INSERT ALL・SELECT・RETURNINGとMERGEの使い分け 2026-10-28 09:59:09
- Oracle 19cのトランザクション制御|COMMIT・ROLLBACK・分離レベルと接続設定 2026-10-28 09:59:09