1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

🌴【SourceTree】SourceTreeでBranchしてPushができなかった為、Git Bashで対応した

Last updated at Posted at 2019-12-15

2020/06/25追記

こちらの方法で対応可能でした
https://qiita.com/nmss208/items/a212c242da64dce89332

環境

SourceTree
Windows 10
Git Bash

やったこと

ローカルでmasterからhoge/fuga branchを作成したのでリモートにpushしようとした

SourceTreeにてBranchを追加してPush

The リモートブランチ '' (ローカルブランチ = 'hoge/fuga') is invalid. Ref names must follow git ref-format rules: 
https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
エラー終了しました。エラーの内容は上記をご覧ください。

 →✖リモートブランチが空白になっている(未作成だから?)

Git Bashで単純なgit push実行

$ git push
fatal: The current branch hoge/fuga has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin hoge/fuga

 →✖upstreamでないため実行コマンドを提示された

--set-upstreamを付加してコマンド実行

$ git push --set-upstream hoge/fuga master
fatal: 'hoge/fuga' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

 →✖だめでした...

-u(追跡オプション)をつけてコマンド実行

$ git push -u origin hoge/fuga

 →🔵push成功!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?