1
0

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.

git push -u origin mainでpushされずerrorになる

Last updated at Posted at 2021-02-19

rails tutorialのversion 6.0の1章でgitの扱い方を学びながら進めていたがgit push -u origin mainをしたら下記のようなエラーに遭遇した

#terminal

error: src refspec main does not match any
error: failed to push some refs to '自分のgithubアカウント'

#原因
2020/10月からgithubはレポジトリ名をmasterからmainに変更したためmainでpushしてもレポジトリ名が違うためerrorになるとのこと

次のようにgit branchで調べるとその通りだった

% git branch
* master

ので次のようにブランチを変えて解決

% git branch -M main
% git branch
* main

まだまだ初学者なのだと実感させられる

#参考になったURL
https://deepblue-ts.co.jp/tips/git-push-error/

1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?