| この記事の要点 |
|---|
|
エラーの状況
$ 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 / Maya)
- 7 Spring Frameworkのアノテーション一覧
- 8 【Spring】@Valueアノテーションとは
- 9 CATALINA_HOME の確認方法 (Linux / Mac)
- 10 【Spring】@Autowiredアノテーションとは
最近更新/作成されたページ
- プロジェクトをTomcatプロジェクトとして認識させる方法 2026-10-07 22:32:50
- MySQLの1366 Incorrect string value|Laravelの文字コード・絵文字エラー 2026-10-07 21:54:03
- curlの証明書ホスト名不一致|旧エラー51・現行60の確認と対処 2026-10-07 21:54:03
- LaravelのMassAssignmentException|fillableの原因と安全な対処 2026-10-07 21:54:03
- Eclipse で Tomcat の起動ログがコンソールに出ない時の確認手順 2026-10-07 21:54:02
- MySQLにおける中央値(Median)の導き方(バージョン8未満) 2026-10-07 13:49:45
- getInputForward 2026-10-07 13:41:15
- JSONから配列に変換 2026-10-07 13:41:15
- ビューから値をモデルに格納しコントローラーで受け取る方法 2026-10-07 13:23:41
- Laravelのテーブル作成と定義変更|マイグレーション・up/down・注意点 2026-10-07 13:23:41
- NumPy 配列に要素を追加する方法 (append / concatenate) 2026-10-07 13:23:41
- MariaDB・MySQLで現在日時を取得する方法|NOW・タイムゾーン・保存型 2026-10-07 13:13:36
- 【django】テンプレートで定数を使用する方法 2026-10-07 13:10:15
- Spring BootにおけるApplication.propertiesの環境依存設定の分割方法 2026-10-07 12:09:35
- Not supported for DML operations【Springエラー】 2026-10-07 11:09:38