I think I made a mistake in configuring my local git, but I can't see anything anywhere. This is something that scares me a lot, as it allows anyone who uses this computer full access to all my personnal projects. I hope I just did something wrong, and can fix it safely. Here is what happened:
- I log in into my personnal GitLab gitlab.somewhere.com via browser with my root account (meperso@dot.com). (v8.5.5)
- I create a new project "bundle" and set it to private.
- I'm at work (windows 7, logged in as me.pro), but decided to check the project permissions for clone and push.
- Surprisingly, the cloning process (via https) completed, with the expected message saying something like "your git repository appears to be empty". I start being concerned, this shouldn't be possible, my project is private, and no account was allowed yet.
- I decide to push it further. I create a file in my local directory, git add it, commit, and push to origin. Everything worked. It didn't even asked for my username/password. In the commit history, in GitLab web interface, the commit is authored by me.pro@local, the Windows 7 login who doesn't have any authorized project on my gitlab.
Additional information : I'm using another Gitlab, hosted in the local network, for the company projects. But I wasn't logged in today.
I need some of my personnal project to get pieces of code, but I don't want someone who will this computer (happens regularily) to be able to push to origin without having to authenticate.
Here is the result of git config --list
I typed outside of any project.
PS C:\> git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
PS C:\>
As you can see, there is not even a global username configured.
EDIT 1
The Windows Credential Manager was indeed storing some credentials. I was able to remove them from the WCM by running rundll32.exe keymgr.dll, KRShowKeyMgr
and removing the line concerning my personal Gitlab at gitlab.somewhere.com.
Authentication was required again, that solves part of the problem.
But GitLab stil accepted the push from me.pro@local, despite the fact that the project is private, has no members, and the owner is meperso@dot.com.
the problem is still there...
Bonus question : how to prevent WCM to store credentials for a specific project ?
Answer : How do I disable git's credential helper for a single repository?
TL;DR: in your project-folder/.git/config, put helper =
(empty string) in the [credential]
section (or create it). Requires git 2.9+.
EDIT 2
I have a theory for the commit-that-should-not-be :
In WCM, there were also my project owner account. The commit was authenticated with these credentials, but the name was my Windows user.
I can't check that theory, I deleted the credentials from the manager before suspecting this.