Agile&DevOps系列-8.连接Bitbucket并上传Nuget项目代码

本文详细介绍了如何在Bitbucket服务器上创建项目及仓库,使用Git进行代码初始化、上传和远程操作流程。涵盖了从本地到服务器的代码推送、远程分支创建、代码更新和提交等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

启动Bitbucket服务器,waiting.... 登录ing

 

1.创建项目

完成之后点击项目进入 ,然后创建仓库

下图就是创建好的空仓库

 

下面命令是使用git bash初始化项目代码和上传相关 Mark 一下

---------------------------------------------

Configure Git for the first time

git config --global user.name "gaosiji"

git config --global user.email "gaosiji20080303@126.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 http://localhost:7990/scm/...../nugetserver.git

 

My code is ready to be pushed

If you already have code ready to be pushed to this repository then run this in your terminal.

cd 项目根目录

git init

git add --all

git commit -m "Initial Commit"

git remote add origin http://localhost:7990/scm/..../nugetserver.git

git push -u origin master

 

My code is already tracked by Git

If your code is already tracked by Git then set this repository as your "origin" to push to.

cd 项目根目录

git remote set-url origin http://localhost:7990/scm/..../nugetserver.git

git push -u origin --all

git push origin --tags

---------------------------------------------

2.客户机初始化已经写好的项目和代码

启动客户机git bash

进入项目根目录

cd C:/Dev/NugetServer/NugetServer

记得目录的分级用 / 而不是 \

git init

git add --all (由于需要忽略的文件和目录比较多这里统一添加,再用GUI工具去添加忽略)

git commit -m "Initial Commit"

git remote add origin http://localhost:7990/scm/..../nugetserver.git

git push -u origin master

 

最后一步弹出鉴权登录窗口

git credential manager for windows

输入bitbucket你创建的用户名和密码就完成了

 

如果输入或者验证错误,就删除一下登录凭据

经过一系列折腾上传成功 附上两张截图

 

上面操作都是基于本地localhost 一般公司肯定都是私有PC或者云VM

下面就远程方式down一下代码,update 和 commit一下

首先创建一个远程分支,使用bitbucket

 

Branch type 跟据项目对code的操作和即将对线上产品产生的影响选择对应类型,比如新功能开发 选择Feature / 线上问题热修复Hotfix / Bug修改Bugfix / 发布版本 / Release等

创建完成切换到ChinaDev分支

 

前置条件:

1.获取Bitbucket服务器Ip或者域名

2.客户机可以ping通或者访问Bitbucket域名

Sourcetree方式 ,通过客户机访问bitbucket然后找到分支Checkout

或者直接用git 命令

cd 客户机项目目录

git init

git remote add origin https://192.168.110.239:7990/scm/cnb/nugetserver.git

git fetch origin

git checkout -b local_dev origin/ChinaDev

git checkout local_dev

 

如果配置错了remote url 可以使用如下命令修改remote URL

git remote rm origin

git remote add origin [url]

 

或者也可以在客户机使用任何git工具进行操作, 小乌龟、github desktop等等。

 

下载完成之后随便修改点东西,然后提交commit 之后,在push到remote 仓库

此时查看bitbucket就可以看到记录了,

 

后续会继续开关于开发分支、版本控制、release、发布相关文章已经操作bitbucket的PR等相关操作

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值