Deploy to artifactory based on the data from repo

62 views Asked by At

Would like to know how can use curl to get file from a repository for instance gogs and push to another repository for instance artifacotry. I saw we can use -T which can get from url. The below code works however, it will get the local file test.tx. I want to get it from repo and deploy to artifacotry

curl -X PUT -T test.txt -u username:password "http://123.22.91.243:8080/artifactory/local-file/MyFiles/"
1

There are 1 answers

0
LeGEC On

Getting a file from a repo through curl is not a feature of git alone, it is a feature of web based git servers, like github, gitlab, or gogs.

These servers generally allow you to browse to any file you want within the repo.

For example : on the gitub mirror of the git repo, you can click your way to the checkout.c file :
https://github.com/git/git/blob/master/builtin/checkout.c
and then click on the [Raw] button :
https://raw.githubusercontent.com/git/git/master/builtin/checkout.c

That's a url you can also access using curl.

As it indicates, the above url targets the master branch (which can evolve in time), you can find a way to target a commit identified by its fixed sha1 :

https://raw.githubusercontent.com/git/git/385c171a018f2747b329bcfa6be8eda1709e5abd/builtin/checkout.c

Browse on your own server to find out how urls are built.