作者:信妹氵V | 来源:互联网 | 2023-05-27 15:21
我正在尝试通过Git Bash删除远程git存储库.我知道我可以通过GitHub删除它; 但是,我想通过命令行学习如何这样做.我不只是想删除它中的文件,或者替换它,我想完全删除它.我花了最后两天筛选论坛,文章,博客和教程,但没有任何工作.
一些初始信息:
$ git remote -v
thisbranch https://github.com/thisuser/test-repo.git (fetch)
thisbranch https://github.com/thisuser/test-repo.git (push)
$ git status
On branch master
nothing to commit, working directory clean
$ git log
Author: *info*
Date: *info*
adding a new file
Author: *info*
Date: *info*
Initial commit
$ git remote -v show thisbranch
* remote thisbranch
Fetch URL: https://github.com/thisuser/test-repo.git
Push URL: https://github.com/thisuser/test-repo.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (up to date)
我试过的一些事情:
$ git remote remove https://github.com/thisuser/test-repo.git
error: Could not remove config section 'remote.https://github.com/thisuser/test-repo.git'
$ git remote remove master
error: Could not remove config section 'remote.master'
$ git remote remove thisbranch
*returns nothing*
$ git remote -v
*returns nothing*
我意识到我也永远不会归还"起源"这个名字.
1> jub0bs..:
正如BrokenBinary在评论中指出的那样,
这是不可能做到的.
您不能使用Git命令删除远程仓库(托管在GitHub或其他地方),无论是在Git Bash还是其他地方,期间.您可以删除远程分支(假设您具有对它们的写入权限),是,但不是整个远程存储库.
但是,GitHub Developer API允许您从shell中删除GitHub上托管的repo.
感谢@BrokenBrinary和Jubobs。我想我要回去直接从GitHub站点删除存储库。
2> daGo..:
正如上面提到的Jubobs你可以使用github dev API,所以:
curl -u :username -X "DELETE" https://api.github.com/repos/:username/:repo
Where :username =你的用户名(github处理程序)和:repo =你想要摆脱的repo的名字