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?

オンプレのgitサーバにアクセスできなかった対処(safe directory)

Posted at

起きたこと

PC交換で新しいPCを初期設定した後gitでpullしたら、以下のようなメッセージがでた。
社内のオンプレGitサーバのリモートリポジトリに接続できないよう。

fatal: unsafe repository ('D:/workspace' is owned by someone else)`
To add an exception for this directory, call:
    git config --global --add safe.directory 'D:/workspace'

解決方法

git config --global --add safe.directory リモートリポジトリの場所
コマンドを実行する。

safe.directoryのあとにリモートリポジトリのパスを入れる。

注意
'で囲んだりしない(囲んでいたのが間違いだった。)
間違い例 git config --global --add safe.directory 'リモートリポジトリの場所'

設定の削除

' で囲んで増やしてしまった設定はどちらかで対応

  1. .gitconfigを直接編集する
  2. git config --unset-all safe.directory でまるまる削除

1の場合、.gitconfigの場所はWindowsの場合
C:\Users\<ユーザー名>\. gitconfig
にあるので、テキストエディタなんなり。

最初のPC設定の時もひっかかったので記録。

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?