GIT: Import an existing Git project

 Importing code from an existing project | Bitbucket Data Center and Server 7.17 | Atlassian Documentation


git clone -mirror vs. git clone -bare

git clone --bare

Similar to git init --bare, when the -bare argument is passed to git clone, a copy of the remote repository will be made with an omitted working directory. This means that a repository will be set up with the history of the project that can be pushed and pulled from, but cannot be edited directly. In addition, no remote branches for the repo will be configured with the -bare repository. Like git init --bare, this is used to create a hosted repository that developers will not edit directly.

git clone --mirror

Passing the --mirror argument implicitly passes the --bare argument as well. This means the behavior of --bare is inherited by --mirror. Resulting in a bare repo with no editable working files. In addition, --mirror will clone all the extended refs of the remote repository, and maintain remote branch tracking configuration. You can then run git remote update on the mirror and it will overwrite all refs from the origin repo. Giving you exact 'mirrored' functionality.

You can import your existing Git repository into an empty repository in Bitbucket. When you do this, Bitbucket maintains your commit history.

  1. Check out the repository from your existing Git host. Use the --bare parameter:

    git clone --bare https://username@bitbucket.org/exampleuser/old-repository.git
  2. Log into Bitbucket and create a new repository (we've called it repo.git in this example).

  3. Locate the clone URL in the nav panel on the left (for example:  https://username@your.bitbucket.domain:7999 /yourproject/repo.git).

  4. Add Bitbucket as another remote in your local repository:

    cd old-repository
    git remote add bitbucket https://username@your.bitbucket.domain:7999/yourproject/repo.git
  5. Push all branches and tags to the new repository:

    git push --all bitbucket
    git push --tags bitbucket
  6. Remove your temporary local repository:

    cd ..
    rm -rf old-repository

Không có nhận xét nào:

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

 https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...