I want to create bare git project without tags using clone.But through Google came to know that there is no option like "--no-tags
".
Is there any way to clone without tags like below?
$ git clone {path}/test.git --no-tags --mirror
Any help will be appreciated!! :)
When you clone a repository, all the tags associated with the repository will be pulled down. To fetch all the remote tags, use the fetch command as shown below. You can list down all the tags from the git repository using the following command.
git fetch fetches all branch heads (or all specified by the remote. fetch config option), all commits necessary for them, and all tags which are reachable from these branches. In most cases, all tags are reachable in this way. git fetch --tags fetches all tags, all commits necessary for them.
I also got it through some trails and googling.
I used below steps to make it.
1) Initialize a bare repo:
mkdir project
cd project
git init --bare
2) Add your remote and configure the proper refspec for it:
git remote add origin <REPO_URL>
git config remote.origin.fetch +refs/heads/*:refs/heads/*
git config remote.origin.tagopt --no-tags
3) Get the data:
git remote update origin
If you want tags to be omitted just on the very first fetch, then omit setting the remote..tagopt variable and use the
git fetch --no-tags
for fetching the data instead. Note that the next fetch without "--no-tags" will fetch the auto-fetchable tags unless you set the remote..tagopt configuration option before that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With