Bitbucketにコミットしてみる


Bitbucketのリポジトリをクローンする | kazsoga(曽我一弘)ブログ
の続きです。

viコマンドで適当なファイルを作成。ls -aとしているのは、.gitファイルがあることを確認するためです。
無い場合には、git initします。

$ vi text.txt
sogakazuhiro-no-iMac:tutorial sogakazuhiro$ ls -a
. .git README.text sandbucket.jpg
.. README.md sample.html text.txt

あとは、githubと同じで、git addして、

$ git add .

git commitして、
$ git commit -m "はじめてのコミット"
[master a3133cc] はじめてのコミット
Committer: 曽我 一弘
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

git config --global --edit

After doing this, you may fix the identity used for this commit with:

git commit --amend --reset-author

1 file changed, 1 insertion(+)
create mode 100644 text.txt

プッシュします。
$ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

Password for 'https://kazsoga@bitbucket.org':
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 344 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To https://kazsoga@bitbucket.org/kazsoga/tutorial.git
82c782c..a3133cc master -> master

pushできました。

スクリーンショット 2015-07-02 22.47.32

本当は、最初に
git push -u origin master
とした方が良いかも。