質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
GitHub

GitHubは、Gitバージョン管理システムを利用したソフトウェア開発向けの共有ウェブサービスです。GitHub商用プランおよびオープンソースプロジェクト向けの無料アカウントを提供しています。

Q&A

解決済

1回答

1055閲覧

githubのブランチ Masterについて質問です。

L-sunsui

総合スコア45

GitHub

GitHubは、Gitバージョン管理システムを利用したソフトウェア開発向けの共有ウェブサービスです。GitHub商用プランおよびオープンソースプロジェクト向けの無料アカウントを提供しています。

0グッド

0クリップ

投稿2020/06/09 02:37

HTML CSSのポートフォリオ作っています。
fileを1から9までそれぞれコンセプトとデザインが別のページを9個作り

それぞれgit init
git add .
git commit -m "first commit"
git remote add origin https://github.com/dna4570/htdocs9.git
git push -u origin masterのように

してイニット、アド、コミット、プッシュしたのですが、
mbp:~ yokoyamanaonori$ cd desktop
mbp:desktop yokoyamanaonori$ cd htdocs9
mbp:htdocs9 yokoyamanaonori$ ls
Icon? gulpfile.code-workspace index.html
README.md gulpfile.js jquery.min.js
css img js
mbp:htdocs9 yokoyamanaonori$ git init
Reinitialized existing Git repository in /Users/yokoyamanaonori/Desktop/htdocs9/.git/
mbp:htdocs9 yokoyamanaonori$ git add .
mbp:htdocs9 yokoyamanaonori$ git remote add origin https://github.com/htdocs9.git
fatal: remote origin already exists.
mbp:htdocs9 yokoyamanaonori$ git push -u origin master
To github.com:dna4570/htdocs4.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:dna4570/htdocs4.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
mbp:htdocs9 yokoyamanaonori$
コード

ターミナルに高表示されます。 うまく反映されないのですが、masterの他にブランチを作って いくのでしょうか?

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

そのhintを読むと、作業ディレクトリに含まれてない変更がリモートにあるためpushは失敗した、とかいてあります。

書いてあるとおりに、まず、pull してからpushしてみればどうでしょう

投稿2020/06/09 02:45

y_waiwai

総合スコア87774

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

L-sunsui

2020/06/09 06:50

ご返信ありがとうございます。pullしてみます。一度settingsの中のDelete this repository をして作ってるプロジェクト名を変えてpushしてみたのですが ! [rejected] master -> master (fetch first) error: failed to push some refs to 'git@github.com:dna4570/htdocs4.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. となりました。 MASTERは一つじゃないとだめなのでしょうか? 9つプロジェクトがあるなら ブランチも9つ作る必要ありますか?
y_waiwai

2020/06/09 06:54

Gitというのは一つのプリジェクトでリポジトリは一つです。 別のプロジェクトを管理するなら、それぞれ別のリポジトリを作ってください
L-sunsui

2020/06/09 11:56

ありがとうございます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問