gpt4 book ai didi

git - 如何检查对远程 Git 存储库 ("can I push?"的写入权限)

转载 作者:IT王子 更新时间:2023-10-29 00:39:27 25 4
gpt4 key购买 nike

我正在构建一个(有些受限的)Git 客户端。要设置存储库,请输入远程存储库的 URL。我想检查用户是否对该存储库具有读+写访问权限。如果没有,我会显示一个身份验证对话框。

我用 git ls-remote <url> 检查'读取'访问权限 .

是否有类似的方法来检查“写入”访问权限,而无需先克隆存储库? (我知道我可以 git clone <url> 然后 git push --dry-run )

最佳答案

如果 git 仓库在 github 中,打开仓库中的任意文件,然后单击“编辑”,github 将显示如下内容:

You’re editing a file in a project you don’t have write access to. We’ve created a fork of this project for you to commit your proposed changes to. Submitting a change to this file will write it to a new branch in your fork, so you can send a pull request.enter code here

关于git - 如何检查对远程 Git 存储库 ("can I push?"的写入权限),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22811045/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com