Hiển thị các bài đăng có nhãn bitbucket. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn bitbucket. Hiển thị tất cả bài đăng

bitbucket: Import an existing, unversioned code project

 

Import code using the terminal

Import code from an existing project using the terminal by first cloning the repository to your local system and then pushing to an empty Bitbucket repository.

Import an existing, unversioned code project

If you have code on your local machine that is not under source control, you can put it under source control and import it into Bitbucket.

Assuming you have Git installed on your local machine, then:

  1. Locally, change to the root directory of your existing source.
  2. Initialize the project by running the following commands in the terminal:

    git init
    git add --all
    git commit -m "Initial Commit"
  3. Log into Bitbucket and create a new repository.
  4. Locate the clone URL in the nav panel on the left (for example:  https://username@your.bitbucket.domain:7999 /yourproject/repo.git).
  5. Push your files to the repository by running the following commands in the terminal (change the URL accordingly):

    git remote add origin https://username@your.bitbucket.domain:7999/yourproject/repo.git 
    git push -u origin master
  6. Done! Your repository is now available in Bitbucket.

Import an existing Git project 

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

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

Mirror an existing Git repository

You can mirror an existing repository into a repository hosted in Bitbucket.

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

    git clone --mirror https://username@bitbucket.org/exampleuser/repository-to-mirror.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:

    git remote add bitbucket https://username@your.bitbucket.domain:7999/yourproject/repo.git
  5. Then push all branches and tags to Bitbucket:

    git push --all bitbucket
    git push --tags bitbucket
  6. Use git fetch --prune origin  ('–prune' will remove any branches that no longer exist in the remote) followed by the git push commands from step 5 to update the Bitbucket mirror with new changes from the upstream repository.

GIT: Bitbucket delete master branch

 

git - Deleting remote master branch, refused due to being the current branch - Stack Overflow

Note: for Bitbucket, you would change the default branch by accessing the settings of your repository, and changing the branch at the "Main branch" combo box.




Once the main branch is no longer master, then you can push and remove master.

MarsAndBack confirms in the comments this applies to GitHub as well.

Grant access to a workspace

 https://support.atlassian.com/bitbucket-cloud/docs/grant-access-to-a-workspace/


Group access on future repositories

When you create a repository in a workspace with existing user groups, Bitbucket determines if the workspace has any groups with the Default Access permissions of ReadWrite, or Admin. If it does, Bitbucket adds those groups to the new repository with the default permission. If you specify None for the default permissions, Bitbucket ignores that group and doesn't add it.

To update the group permissions for only one repository, you can do so from the User and group access page of the repository settings.

Renewing Facebook Graph API token automatically?

  Mã truy cập dài hạn https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/ https://community.n8n.io/t/re...