为什么我有权推送到新创建的gitlab项目?

时间:2019-05-02 07:20:00

标签: git permissions gitlab

我有一个私人gitlab服务器。我刚刚在名为TestCreateProject的组中创建了一个名为Foo的新项目。使用根帐户创建该项目。

该项目的visibility level私有

enter image description here

它没有成员:

enter image description here

我想知道为什么我可以克隆并推送到该项目。我的意思是我可以毫无问题地运行以下命令:

git clone http://mygitlab.com/root/testcreateproject.git
cd testcreateproject
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

git config --list命令告诉我当前的user.nameuser.email在我的私人gitlab服务器上不存在。

历史记录显示我的user.name在27分钟前撰写了提交。

enter image description here

为什么在克隆并推送到项目时没有被拒绝?

我的社区版gitlab的版本为11.10.0

我的git版本是git version 2.17.2 (Apple Git-113)


------------------------------------编辑---------- --------------------------

通过访问项目中的Settings-> Members,我发现该项目实际上包含1个成员

enter image description here

2 个答案:

答案 0 :(得分:0)

没有没有成员的存储库之类的东西。至少有一个所有者,即创建该存储库的所有者或从先前所有者转移了存储库的那个所有者。

作为所有者,您可以使用存储库执行任何操作-克隆,提取,推送。参见https://docs.gitlab.com/ee/user/permissions.html

答案 1 :(得分:0)

git config --list显示我的credential.helperosxkeychain

因此,我在MacOS中打开 Keychain Access 应用程序,以检查根帐户的用户名和密码是否存储在其中。

然后我发现根帐户的用户名和密码确实存储在 Keychain Access 中。

这意味着git使用存储在 Keychain Access 中的信息来提取并推送到项目。