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?

年に数回使用するコマンドで忘れがちなもの

Last updated at Posted at 2023-04-27

sshの認証鍵を作りたい

ssh-keygen

git

リモートリポジトリの確認

git remote -v

リモートリポジトリの設定削除

git remote rm {originとか}

全てチェックアウト(または変更を破棄)したい

git checkout . && git submodule foreach --recursive git checkout .

git submodule foreach --recursive {やりたいコマンド} は結構使える。

クローンで recursive 忘れてサブモジュールが空っぽ

git submodule update --init --recursive

git の ssh 接続で複数のアカウントを取り扱う

~/.ssh/config
Host XXXX.bitbucket.org      # XXXX を任意に設定
	HostName bitbucket.org   # ここは実際のアクセス先 (HostとHostNameがテレコじゃん。。。)
	User YYYY
	PreferredAuthentications publickey
	IdentityFile /***/.ssh/***   # 公開鍵へのフルパス
	UseKeychain yes
	AddKeysToAgent yes
各リポジトリ/.git/config
[remote "origin"]
        url = git@XXXX.bitbucket.org:YYYY/***.git

これで接続できない場合

ssh で接続してみる。

ssh -T XXXX.bitbucket.org
成功時のメッセージ
authenticated via ssh key.

You can use git to connect to Bitbucket. Shell access is disabled

これがエラーにならないのであれば、この状態で再度 git でアクセスすると接続できる。(何で?)

クローンしたら、先方のsshのfingerprintが更新されたっぽい

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.

~/.ssh/known_hosts で該当のドメインの行を削除

~/.ssh/known_hosts
github.com ssh-rsa XXXXXXX.......

下記コマンドで更新

ssh -T git@github.com
D25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

XCode

ビルドキャッシュを削除

CLIじゃなくて、IDEで用意して欲しい

rm -rf ~/Library/Developer/Xcode/DerivedData

XCBuild の切替

設定

sudo xcode-select --switch /Applications/Xcode.app

確認

xcode-select --print-path
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?