Bitbucket第一次代码仓库创建/提交/创建新分支/合并分支/忽略ignore

1. 首先要在bitbucket上创建一个项目,这个我没有权限创建,是找的管理员创建的。

管理员创建之后,这个项目给了我权限,我就可以创建我的代码仓库了。

2. 点击这个Projects下的具体项目名字,就会进入这样一个页面,

 创建完就可以看到仓库链接了: https://XXX.git

3.在你的本地配置一下用户名和邮箱,然后clone代码提交和push

Configure Git for the first time
> git config --global user.name "ZXX YXX"
> git config --global user.email "yXX.zXX@mail.com"

Working with your repository
I just want to clone this repository
If you want to simply clone this empty repository then run this command in your terminal.

> git clone https://XXX.git

> cd XXX
> git add --all
> git commit -m "Initial Commit"
> git remote add origin https://XXX.git
> git push -u origin HEAD:master
My code is already tracked by Git

4.创建新的分支并提交

> git branch -a
> git checkout -b 'new-branch'
> git add .
> git commit -m 'new-branch'
> git push origin 'new-branch'

5.把master分支合到你的新分支上来

> git checkout master # 切换本地分支为master
> git pull  # 拉取master分支
> git checkout 'new-branch'  # 切换到自己的new-branch分支
> git merge master  # 合并master到自己的分支
> git push # 推送到远程分支

6.增加.ignore

> ls -a #看看项目地下有没有.ignore文件
.git doc other .vscode
> echo '.vscode/settings.json' > .gitignore  #没有的话,创建并加入settings.json
> git commit -m 'ignore'   #提交
> git push   #推送

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Bitbucket supports SSH as a secure protocol for accessing and managing your repositories. To use SSH with Bitbucket, you need to generate an SSH key pair and add the public key to your Bitbucket account. Here are the steps to set up SSH access with Bitbucket: 1. Generate an SSH key pair on your local machine if you don't have one already. You can use the `ssh-keygen` command to generate the key pair. ```bash ssh-keygen -t rsa -b 4096 -C "your_email@example.com" ``` This command will prompt you for a location to save the key pair and a passphrase (optional). Press Enter to accept the default values. 2. Once the key pair is generated, copy the public key to the clipboard using the following command: ```bash pbcopy < ~/.ssh/id_rsa.pub ``` If you're not on macOS, you can manually open the `id_rsa.pub` file and copy its contents. 3. Log in to your Bitbucket account and navigate to your avatar in the bottom left corner and click on "Bitbucket settings." 4. In the left-hand sidebar, click on "SSH keys" under the "Security" section. 5. Click on the "Add key" button. 6. Paste the copied public key into the "Key" field and provide a label for the key (e.g., "My SSH Key"). 7. Click on the "Add key" button to save the SSH key. Once you have set up SSH access, you can clone your repositories using the SSH URL. For example: ```bash git clone git@bitbucket.org:username/repository.git ``` Make sure to replace `username` with your Bitbucket username and `repository` with the name of your repository. That's it! You should now be able to use SSH to access your Bitbucket repositories.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值