1
0

More than 1 year has passed since last update.

github ssh接続【備忘録】

Posted at

①ファイル名を作成する
(ローカルのMAMP上にファイルを作成する場合)
②git上に【任意の名称の】リモートリポジトリを作成する
③ローカルのファイルにgitを以下のコマンドを打って生成する。
git init
④ローカルのgit とリモートのgit を以下のコマンドで連携させる。
git config --local user.name 【自分のgithubユーザー名】
git config --local user.email 【自分のgithubメールアドレス】
⑤ssh方式で連携する場合は、ローカルの.sshにキーを以下のコマンドで生成する。
mk.ssh
cd .ssh

で、sshファイルの中に入る。
ssh-keygen -t rsa
の次に、リモートリポジトリの名称を入れ込んで決定ボタンを押す。
⑥sshファイルのconfigファイルを開いて、.pubの内容をコピーする。(configがない場合は作成する)
⑦gitの公開キーをsettings→SSH and GPC keysに登録を行う。
⑧sshファイル内にあるconfigファイルを編集する
Host 【リポジトリ名】
User git
HostName github.com
Port 22
IdentityFile ~/.ssh/【リポジトリ名】
⑧gitが入っているファイルをターミナルで開いて以下のコマンドを叩いて、ファイルをローカルリポジトリにつなぐ
git remote add origin 【sshファイルのHost名】:【ローカルリポジトリのSSHcode】

⑨新規登録できたらgit pull origin mainでファイルをローカルに落とし込む
⑩作業開始

自分にとっての備忘録です。
よりやりやすい方法あれば、どんどん更新していきます。

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