LoginSignup
0
0

More than 1 year has passed since last update.

【github】privateリポジトリをazure上CentOSマシンからgit cloneする

Posted at

0.事象

リポジトリをpublicにするのが恥ずかしいので、privateに設定したが、
Azure上仮想マシン(centos)からgit cloneを実行するとエラーが発生する。

[xxx@xxx xxx]# git clone https://github.com/xxx/xxx.git
Cloning into 'xxx'...
Username for 'https://github.com': xxx
Password for 'https://xxx@github.com':
remote: Support for password authentication was removed on xxx, xxx. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/xxx/xxx.git/'

1.環境

Azure環境OS:CentOS Linux release 7.9.2009 (Core)

2.解決策

github上で、cloneができる権限を付与したtokenの発行を行い、
パスワード入力の際にtokenを使用する。

1)githubのwebUI右上のアイコンをクリック。
image.png

2) settingsをクリック。
image.png

3) 画面を少しスクロールして「Developer settings」をクリック。
image.png

4) 「Personal access tokens」をクリックして、「Generate new token」をクリック。
image.png
image.png

5) 適当にNoteを入力、期間を選択し、「repo」にチェックを入れる。
image.png
image.png

6) 画面をスクロールし、Generate token をクリック
image.png

7) 画面に長い文字列が表示されるので、それをテキスト等に保存しておく。

8) 仮想マシンにアクセスして、git cloneコマンドをたたいてユーザを入力したあと、
 パスワードが聞かれると思うので、そのタイミングで先ほどの長い文字列をペーストするとclone完了。

3.まとめ

github difficult but useful

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