LoginSignup
91
69

More than 3 years have passed since last update.

GitHubでgit操作するときはhttpsの方が999999倍楽

Last updated at Posted at 2019-11-08

概要

今まではsshを使用しており、リポジトリを作るたびに~/.sshフォルダに入りssh-keygen -t rsaして鍵を作り、configを書きリポジトリに鍵を登録するところまでやってから開発していました。

ですが、どうやらGithubにおいてはhttpsがいつのまにか主流になっていたようです。

参照: https://help.github.com/ja/github/using-git/which-remote-url-should-i-use

というわけで、https時代のgit操作についてメモしておきたいと思います。

clone

Githubのcloneボタンからurlをコピペしてclone。

sshならば切り替える必要がありますが、httpsならデフォなのでそのままコピペでおkです。

基本はこれでOK、pushするときに最初だけパスワード入力が必要だったはず

詳しくは多分ググれば出てくると思います

git操作ユーザを明示的に切り替えたい場合(会社用、私用などで分けているパターン)

コマンドを打てばユーザを指定できる。

git remote set-url origin https://git操作したいユーザ名@github.com/ユーザ名/リポジトリ名.git

example

git remote set-url origin https://Ancient-Scapes@github.com/Ancient-Scapes/prettier-plugin-svelte.git

参考

gitでpushしようとしたら403された話

こちらを参考にさせていただきました!ありがとうございます!

91
69
6

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
91
69