0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

あるリモートリポジトリからcloneした内容を別のリポジトリにpushする方法

Posted at

1. リモートリポジトリからcloneする

コマンド
git clone [cloneするリポジトリのURL]

cloneしたリポジトリ名とこれからpushするリポジトリ名が違う場合は

コマンド
git clone [cloneするリポジトリのURL] [pushするリポジトリ名]

としてリポジトリ名を変えておく。

リモート元URLが正しいか確認しておく。

コマンド
$git remote -v
結果
origin [cloneしたリポジトリのURL] (fetch)
origin [cloneしたリポジトリのURL] (push)

git clone で入力したURLと同じであればOK

2. リモート元URLの変更

コマンド
git remote set-url origin [これからpushするリポジトリのURL]

こちらもpushするリポジトリのURLと一致しているか確認する

コマンド
$git remote -v
結果
origin [これからpushするリポジトリのURL] (fetch)
origin [これからpushするリポジトリのURL] (push)

git remote set-url origin で入力したURLと同じであればOK

3. リモートリポジトリにpush

コマンド
$git push origin main

GitHubでリポジトリを開いて変更が反映されているか確認する。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?