我正在尝试使用 curl 和以下命令从 Bitbucket 存储库获取原始文件(我尝试了很多,但我包括最后两个):
curl -L -O https://user:password@bitbucket.org/username/repository/branch/HEAD/filename.txt
curl -L -O https://user:password@bitbucket.org/username/repository/branch/raw/filename.txt
我有一个提交到 master 分支的文件,名为 filename.txt
我想获取上述文件的原始版本。我需要什么代码才能得到它?我从这些命令中得到的只是页面包含的 HTML 代码。
注意:对于这种特定用途,安全性不是问题。我还在以下链接中尝试了解决方案:Download private BitBucket repository zip file using http authentication
最佳答案
您几乎成功了,请尝试以下操作:
curl -O -u username:password https://bitbucket.org/username/repository/raw/branch/filename.txt
Here is the documentation for curl
-O
,--remote-name
: "Write output to a local file named like the remote file we get. (Only the file part of the remote file is used, the path is cut off.)"
-u
,--user
<user:password>
: "Specify the user name and password to use for server authentication."
关于git - CURL 从具有安全性的 BitBucket 存储库中获取原始文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54200009/