1.ssh keyの発行
cd /home/ubuntu ssh-keygen
ここで3回ほど入力を求められるので、すべてEnterキーでOK。
cd /home/ubuntu/.ssh cat id_rsa.pub
2.Githubへの登録
Github上にて、「Settings」→「SSH and GPG keys」→「New SSH key」
3.Githubへのpush
PaizaCloudに戻り、
cd /home/ubuntu/<プッシュする対象のアプリ名>
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/<GitHubのユーザ名>/<リポジトリ名(アプリ名)>.git
git push -u origin master
git remote add origin https://github.com/
ここで、GIthubのユーザー名とパスワードが求められる。
ユーザー名は単純に入力してEnterでOK。
Username for 'https://github.com': <ユーザー名>
パスワードは、ログインパスワードを入力してもエラーとなる。
remote: Support for password authentication was removed on August 13, 2021. remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication. fatal: Authentication failed for 'https://github.com/<ユーザー名>/<アプリ名>.git/'
tokenの生成
Github上にて、「Settings」→「Developer settings(下のほうにある)」→「Personal access tokens」→「Generate new token」で生成する。
必要な権限を付与する
適切な権限を付与することが望ましいが、プライベートのみの使用であれば全部つけてしまっても問題ないだろう。
無料版を使用している場合
24時間でサーバーが消滅するので、都度鍵の発行・登録を行う必要がある。
Githubから持ってくる場合(クローン)
git clone [コピーしたいリポジトリのURL]