Download file from github repo npm
Looks like the solution provided applies to all git repositories and not just the github one. This doesn't actually do what was desired, though. It still clones the whole repository, it just doesn't check out some folders. Resolved here : stackoverflow. I get this error: Sparse checkout leaves no entry on working directory. GitHub's web interface, or gitweb could choose to provide an interface for you to extract a given folder, but to my knowledge none of them do that though they do let you download individual files, so if the folder does not contain too many files, that is an option Edit - GitHub actually offers access via SVN, which would allow you to do just this as per comment.
GitHub User Interface There's a download button on the repository's homepage. Of course, this downloads the entire repo, after which you would need to unzip the download and then manually drag out the specific folder you need. Third Party Tools There are a variety of browser extensions and web apps that can handle this, with DownGit being one of them. Subversion GitHub does not support git-archive the git feature that would allow us to download specific folders.
GitHub does however, support a variety of Subversion features, one of which we can use for this purpose.
Subversion is a version control system an alternative to git. You'll need Subversion installed. You'll need to modify this URL, though. You want the link to the repository, followed by the word "trunk", and ending with the path to the nested folder.
And this is actually what DownGit is using under the hood. This gives you JSON data for all of the content that exists in that folder. The data has everything you need, including whether or not the content is a folder or file, a download URL if it's a file, and an API endpoint if it's a folder so that you can get the data for that folder.
Using this data, the script can recursively go through all content in the target folder, create folders for nested folders, and download all of the files for each folder.
Check out DownGit's code for inspiration. If you don't see a download link, make sure you're on a main repo page not a child directory. Seems like you can only download a zip of the entire repo. Also, this github help page might be useful.
Easy point-and-click access. Easy to get a prior release. Easy to pull the desired folder out of the downloaded zip. Thank you. The generic URL to get download from in tar. Willem van Ketwich Willem van Ketwich 4, 7 7 gold badges 46 46 silver badges 53 53 bronze badges.
Github creates a wrapper directory with the commit ref in the name, so it can't be known. Albin Albin 2, 2 2 gold badges 23 23 silver badges 25 25 bronze badges. Just need to change checkout to export if you just want to download a copy of the folder rather than checkout. Thank you for your answer, can we dive a branch?
Interesting and upvoted. I suppose I must have mentioned this 2. VonC I think I beat you to it this once: stackoverflow. I was of course Googling today a bit after 2. I don't intend to beat you on git though, too hard, but keep an eye on necromancer counts! Well, keep up the good work: the all community will benefit from this little side competition and I did upvote your other answer at the time — VonC.
VonC joking of course, I upvote your stuff as well obviously. Meir Gabay Meir Gabay 1, 1 1 gold badge 19 19 silver badges 24 24 bronze badges. Thank You. I can vouch that it works for Windows. Doesn't work on gcloud though. You can do a simple download of the directory tree: git archive --remote git github. Make sure your core. Although this might be the right direction, this answer is invalid.
Calvin Calvin 1 1 silver badge 7 7 bronze badges. This works only for single files. Please, read the question carefuly, before posting an answer. I presented that command in stackoverflow. Just 5 steps to go Download SVN from here. Gray Programmerz 2 2 silver badges 11 11 bronze badges. John Washburn John Washburn 1 1 gold badge 5 5 silver badges 11 11 bronze badges. It's one of the few places where SVN is better than Git.
In the end we've gravitated towards three options: Use wget to grab the data from GitHub using the raw file view. If using direct without clone, you must pass the full url to the zip file, including paths to branches if needed. If using direct with clone, you must pass the full url to the git repo and you can specify a branch like direct:url my-branch. Using git clone from GitLab repository with custom origin and protocol.
Note that the repository type github , gitlab etc. Git gitlab. In addition to having the shorthand for supported git hosts, you can also hit a repository directly with: Direct - direct:url This will bypass the shorthand normalizer and pass url directly. Sagiv Ofek Sagiv Ofek Tyler Liu Tyler Liu Alex Cory Alex Cory 7, 7 7 gold badges 44 44 silver badges 54 54 bronze badges. You definitely have to have a package. Which I forget add. Bruce Lee Bruce Lee 3, 2 2 gold badges 25 25 silver badges 24 24 bronze badges.
You do not need a dist folder or any build code in your repo. You just need to use a prepare script in package.
Khurshid Ansari Khurshid Ansari 3, 2 2 gold badges 28 28 silver badges 43 43 bronze badges. Zephyr Zephyr 1 1 gold badge 7 7 silver badges 19 19 bronze badges. If you get something like this: npm ERR! Joseph Briggs Joseph Briggs 7 7 silver badges 21 21 bronze badges.
This works for me and it is less typing. Omar Omeiri Omar Omeiri 1 1 gold badge 7 7 silver badges 17 17 bronze badges. Siddharth Murugan Siddharth Murugan 81 2 2 silver badges 4 4 bronze badges.
Rahil Lakhani Rahil Lakhani 3 3 silver badges 6 6 bronze badges. MarekFajkus if you install on Linux through a package manager using sudo RayFoss A year late but Why two commands? Should both be used in that order. Or only one or the other? This is not clear. Can you elaborate?
Please respond by editing changing your answer , not here in comments without "Edit:", "Update:", or similar - the answer should appear as if it was written today. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast what if you could invest in your favorite developer?
Most public repositories can be downloaded for free, without even a user account. This is because public repositories are considered to be codebases that are open source.
That said, unless the owner of the codebase checks a box otherwise, their codebase can be downloaded onto your computer, packed into a.
0コメント