3
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 5 years have passed since last update.

リポジトリ名を変えてみた!

3
Last updated at Posted at 2019-10-29

ローカルで作成したアプリケーションをherokuに移そうとしたところ、「プロジェクト名にherokuで使用できない文字が使われている」という旨のエラーを弾かれたので、プロジェクト名を変更することにしました。

ツール

OS:Windows10
エディタ:Visual Studio Code
GIT for WindowsとGIT BASHはインストール済み

GITHUB上

対象のリポジトリに入り、「Settings」をクリック。
「Repository name」の欄に変えたい名前を入力し、「Rename」をクリックすると、リポジトリ名の変更が完了!
意外と簡単でした。

ローカル上

GITHUBだけ変更して終わりではありません。
ローカルリポジトリなど複数の所と連携している場合は、全て変更しなければなりません。
今回はローカルで作ったものなので、ローカルリポジトリだけ変更します。

Visual Studio Codeで対象のフォルダのターミナルを開き、以下のコードでgit configを確認します。

$ git config -l

こちらを打ち込むと、ターミナルにそのリポジトリに関する情報が現れます。
今回の場合は、以下の部分を変えます。

remote.origin.url=https://github.com/username/repositoryname.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*

確認したら「Q」でリストを閉じ、以下のコマンドでgit configを直接編集します。

$ git config -e

すると、エディタ上でgit configを編集できるようになりますので、remote.origin.urlのリポジトリ名(.gitの部分)をGITHUB上で変更したものと同じ名前に変更します。

まとめ

今回はリポジトリ名を変更するだけでしたが、調べながらやった為、ノートとしてこちらの記事を寄稿させていただきました。

参考文献

・[GitHubのリポジトリをリネームする]
(http://dotnsf.blog.jp/archives/1071287129.html)

・[.gitconfigファイルを直接いじってみる(設定関係メモ)]
(https://qiita.com/KTakata/items/470da16b9e53799dcb65)

3
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
3
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?