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

Githubプライベートレポジトリでgit cloneとgit remote addを行う時のURL

Posted at

※ssh部分は省略

##tldr;
URLのgithub.comの前にユーザー名+@をつける

##git clone(ユーザー名 = user01の場合)

git clone https://user01@github.com/xxxx/xxxx.git

##git remote add(ユーザー名 = user01の場合)

git remote add origin https://user01@github.com/xxxx/xxxx.git

##誤ってプライベートリポジトリをパブリックリポジトリの形式でremote add originしてしまった時の対処法

###1. リモートリポジトリのURLを確認

git remote -v

以下の結果が出力されることを確認

origin	https://user01@github.com/xxxx/xxxx.git (fetch)
origin	https://user01@github.com/xxxx/xxxx.git (push)

###2. 既存のリモートリポジトリを削除

git remote rm origin;
git remote remote -v # 何も表示されないことを確認

###3. 正しいURLでremote addし直す(ユーザー名 = user01の場合)

git remote add origin https://user01@github.com/xxxx/xxxx.git
0
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
0
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?