Created
July 6, 2024 18:51
-
-
Save mesheets/ed81b96893e3c6d3f8a2549ae8d0fd81 to your computer and use it in GitHub Desktop.
Clone Git Vendor Refs (such as exist in the GNU GCC project)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # List the remote vendor refs | |
| git ls-remote --refs git://gcc.gnu.org/git/gcc.git refs/vendors/st/\* | |
| # Initialize an empty git repository | |
| git init | |
| # Add a remote for the GNU GCC repository: git remote add -t <branch> <remote name> <repository> | |
| git remote add -t refs/vendors/st/heads/README gnu-st git://gcc.gnu.org/git/gcc.git | |
| # The .git/config file is created with an improperly-formed fetch entry that must be manually corrected | |
| # Find the following "remote" section in the file: [remote "gnu-st"] | |
| # Look for the following "fetch" entry: fetch = +refs/heads/refs/vendors/st/heads/README:refs/remotes/gnu-st/refs/vendors/st/heads/README | |
| # Remove the "refs/heads" prefix | |
| # The line should instead read as follows: fetch = +refs/vendors/st/heads/README:refs/remotes/gnu-st/refs/vendors/st/heads/README | |
| # Save the modified .git/config file | |
| # Fetch from the remote: git fetch <remote name> | |
| git fetch gnu-st | |
| # Reset the repository to that commit | |
| git reset --hard FETCH_HEAD | |
| # Add a remote for our working remote: git remote add <remote name> <remote URL> | |
| # -To make this remote the default, name it "origin" | |
| git remote add origin https://github.com/BrickBot/gnu-cil-README.git | |
| # Mirror this repository to the working remote: git push --mirror --force <remote name> | |
| git push --mirror --force origin | |
| # NOTE: If later cloning from origin, .git/config will likely be missing the "gnu-st" remote, | |
| # so follow the "git remote add -t <branch> <remote name> <repository>" | |
| # and .git/config edit steps to recreate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment