Remove credentials from Git

后端 未结 30 2437
不知归路
不知归路 2020-11-21 10:13

I\'m working with several repositories, but lately I was just working in our internal one and all was great.

Today I had to commit and push code into other one, but

30条回答
  •  佛祖请我去吃肉
    2020-11-21 10:44

    If your credentials are stored in the credential helper (generally the case), the portable way to remove a password persisted for a specific host is to call git credential reject:

    • in one line:

      $ echo "url=https://appharbor.com" | git credential reject
      
    • or interactively:

      $ git credential reject
      protocol=https
      host=gitlab.com
      username=me@example.com
      ↵
      
      • ↵ is the Enter symbol, just hit Enter key twice at the end of input, don't copy/paste it
      • The username doesn't seem recognized by wincred, so avoid to filter by username on Windows

    After that, to enter your new password, type git fetch.

    https://git-scm.com/docs/git-credential

提交回复
热议问题