I want to clear github password and found answer here: link
git credential-osxkeychain erase
host=github.com
protocol=https
But I want to do it faster with Makefile.
When to try it in console:
Step 1: enter command
git credential-osxkeychain erase
Step 2: enter parameters
host=github.com
protocol=https
When I try to do it with Makefile, each line works as different command, that is wrong:
clean:
git credential-osxkeychain erase
host=github.com
protocol=https
How to do it correct?
Why I do this? Because, I want to make github to ask my password and email when pushing. I was tried a lot of thing but noting didnt help (macOS Catalina):
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=1'
git config --local --unset credential.helper
git config --global --unset credential.helper
git config --system --unset credential.helper
Maybe you now answer?
The way to do this is the following:
echo "url=https://github.com" | git credential erase
# or
printf "%s\n" host=github.com protocol=https | git credential erase
Note that you should not put this in any project that anyone else might use, because other people will not appreciate your project deleting their GitHub credentials when running make clean
.
If your goal is to just use multiple accounts with GitHub, then you can do that by adding the correct account to the URL, like so:
git remote set-url origin https://bk2204@github.com/git/git.git
or specifying the right username during clone.
Credential helpers know how to handle multiple accounts with different usernames, so if you always use the username, then they will always pick the right password, even if you have more than one account.
When asking questions you should always describe what happens, and why what happens is not what you wanted to happen.
Without knowing for sure, I can only assume that the problem you have is that even after make clean
the environment variables host
and protocol
are not set as you want them to be.
There is no way to do what you want to do by running make alone. See this answer: https://stackoverflow.com/a/54877556/939557
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.