#author("2020-08-27T00:32:42+09:00","default:ryuichi","ryuichi")
#author("2020-08-27T00:34:45+09:00","default:ryuichi","ryuichi")
* push時に--set-upstreamを聞かれるのを省略する [#i1f3acbb]

** 現象 [#e7645eba]
 $ git branch branch1
 $ git co branch1
 (略)
 $ git commit -m 'N/A'
 $ git push
 
 fatal: The current branch branch1 has no upstream branch.
 To push the current branch and set the remote as upstream, use
 
    git push --set-upstream origin branch1
 


- 新規ブランチ(ここではbranch1)を作って、何かしらコミット後にgit pushすると、リモートブランチを指定してないので、上のようなエラーメッセージが表示される
- '''git push --set-upstream origin branch1'''としてpushすればいいが、毎回面倒なら以下のようにする
- '''git push --set-upstream origin branch1'''としてpushすればいいが、毎回面倒なので省略したい

** リモートブランチ名を現在のローカルのブランチ名にする [#g1b3a241]

 $ git config push.default current
 (または git config --global push.default current )
 $ git push

- 上のようなコマンドで.gitconfig(.git/config)に設定をした後、pushする


トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS