Jay Mody
Jay Mody

Reputation: 4033

Downloading a Github repo without having git installed

Background

I've setup a github repo for all my dotfiles: https://github.com/jaymody/dotfiles

The idea is that if I were to reset my machine (mac, although I have plans to adapt this for linux), I can basically download the repo, run a script and all my preferences/settings/apps are installed.

It works fine, except I realized in order to get the repository I'd need git already installed on my machine in order to git clone the repository. I don't like the idea of having to install git, when the whole purpose of the repo is to handle all that stuff (it installs git via homebrew).

I know you can git archive your repositories to create a .zip file, so a simple solution would be to store the .zip file in the repo itself and use wget or curl to get the zip. Although I feel like there has to be a better solution than that. I know you can also create archives for tags but the issue there is I would always want a tag for the latest commit of my repository.

Current Functionality

echo "export DOTFILES_ROOT=path/to/where/you/want/to/save/this/repo/" >> ~/.localrc
source ~/.localrc
git clone https://github.com/jaymody/dotfiles.git $DOTFILES_ROOT

cd $DOTFILES_ROOT
./bootstrap

Desired Functionality

echo "export DOTFILES_ROOT=path/to/where/you/want/to/save/this/repo/" >> ~/.localrc
source ~/.localrc
##### DOWNLOAD GITHUB REPO WITHOUT USING GIT HERE #####

cd $DOTFILES_ROOT
./bootstrap

Note: Obviously this is overkill and I would almost never need to use this functionality, but if I'm over-automating stuff, might as well go the full out.

Upvotes: 0

Views: 3409

Answers (1)

Frak
Frak

Reputation: 865

Use this to download it as a zip file instead.

wget https://github.com/jaymody/dotfiles/archive/master.zip
unzip master.zip

Upvotes: 3

Related Questions