LoginSignup
26
29

More than 5 years have passed since last update.

[Bitbucket]リポジトリを最初にpushする方法

Posted at

やりたいこと

Bitbucketにリポジトリをあげたい

やったこと

  1. AndroidStudioでプロジェクト作成
  2. Bitbucketで リポジトリ->作成->名前入力->作成
  3. Command line (どちらなのかで迷う)
    • 私はゼロからスタートします。
    • I have an existing project
  4. I have an existing projectだろうと思い、進める

エラー

git push -u origin --allとしたところで

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
Everything up-to-date

もう一度pushしてみると

error: src refspec master does not match any.
error: failed to push some refs to 

解説

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
Everything up-to-date

これはリモートリポジトリ上にまだmasterブランチが作成されていないというエラー
初めは省略しないでブランチ名を書く

参考
逆引き Git TOP > トラブルシューティング
http://www.backlog.jp/git-guide/reference/trouble-shooting.html

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
Everything up-to-date

これはコミットしてないというエラー
commitをしてからpushする

参考
解決: src refspec master does not match any. failed to push some refs to.
http://d.hatena.ne.jp/nishiohirokazu/20110304/1299229916

最終的にやったことまとめ

git init
git remote add origin https://-----
echo "アカウント名" >> contributors.txt
git add contributors.txt
git commit -m "first commit"
git push -u origin master

結局
「私はゼロからスタートします。」を選択すれば良かったのでした。

26
29
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
26
29