使用git上传更改的代码

  1. 进入目录~/gopath/src/github.com/hyperledger/fabric-ca
  2. 查看当前版本,以及变更记录
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git status


3. 将本地的fabric ca重命名

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger# mv  fabric-ca  fabric-ca-bak

4. 从gitlab.lenovo.com 上git clone下来

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger# git clone https://gitlab.lenovo.com/blockchain/backend/fabric-ca.git

遇到的问题:(原理)

解决方法:

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger# export GIT_SSL_NO_VERIFY=1
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger# git clone https://gitlab.lenovo.com/blockchain/backend/fabric-ca.git
正克隆到 'fabric-ca'...
Username for 'https://gitlab.lenovo.com': ^C
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger# git clone git@gitlab.lenovo.com:blockchain/backend/fabric-ca.git
5. 查看当前版本:
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git status
头指针分离于 v1.0.5
无文件要提交,干净的工作区

6. 切换到一个新的分支

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git checkout -b dev_tcert v1.0.5
切换到一个新分支 'dev_tcert'
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git status
位于分支 dev_tcert
无文件要提交,干净的工作区

查看makefile文件

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# ls
api  CHANGELOG.md  ci.properties  cmd  CONTRIBUTING.md  docker  docker-env.mk  docs  images  lib  LICENSE  MAINTAINERS.md  Makefile  README.md  release_notes  scripts  swagger  testdata  util  vendor
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# vi Makefile 

7. 比较文件的不同

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# diff api/client.go ../fabric-ca-bak/api/client.go
23a24,25
> 	//"github.com/hyperledger/fabric-ca/lib"
> 
103a106
> 
109c112
< 	Count int `json:"count"`
---
> 	Count int `json:"count" help:"Reason for count"`
125,126c128,136
< 	// CAName is the name of the CA to connect to
< 	CAName string `json:"caname,omitempty" skip:"true"`
---
> }
> 
> // GetServerInfoResponse is the response from the GetServerInfo call
> type serverInfoResponseNet struct {
> 	// CAName is the name of the CA
> 	CAName string
> 	// CAChain is the PEM-encoded bytes of the fabric-ca-server's CA chain.
> 	// The 1st element of the chain is the root CA cert
> 	CAChain []byte
133a144,148
> // TEnrollmentResponse is the response from Client.TEnroll
> type TEnrollmentResponse struct {
> 	GetBatchResponse   *tcert.GetBatchResponse
> 	//ServerInfo GetServerInfoResponse
> }
153a169,172
> 
> /*func newBatchResponse(cert []byte)  *tcert.GetBatchResponse{
> 
> }*/
\ 文件尾没有 newline 字符
8. 覆盖原来的文件
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# cp ../fabric-ca-bak/api/client.go api/client.go
查看说明只是覆盖了文件,还没有提交
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git status
位于分支 dev_tcert
尚未暂存以备提交的变更:
  (使用 "git add <文件>..." 更新要提交的内容)
  (使用 "git checkout -- <文件>..." 丢弃工作区的改动)

	修改:     api/client.go

修改尚未加入提交(使用 "git add" 和/或 "git commit -a")

9. 提交文件: 出现提示,说明还未设置用户

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git commit -m "create new branch dev_tcert based on v1.0.5"
*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'root@guoqx2-ThinkCentre-E75.(none)')

设置用户

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git config --global user.email "guoqx2@lenovo.com"
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git config --global user.name "guoqx2"

再次提交:

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git commit -m "create new branch dev_tcert based on v1.0.5"
位于分支 dev_tcert
尚未暂存以备提交的变更:
	修改:     api/client.go

修改尚未加入提交
10. push到gitlab 的分支上去
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git push origin dev_tcert
Total 0 (delta 0), reused 0 (delta 0)
remote: 
remote: ========================================================================
remote: 
remote:                    Welcome to Lenovo Research GitLab.
remote:                                     
remote:     If you want to create a project or request access to a project,
remote:    please send email to the Project Manager and People Manager and CC
remote:                                  to me.
remote:                                     
remote:     If you hit ssl certificate problem during cloning, please issue
remote:                      below command before cloning:
remote:                #git config --global http.sslverify false
remote:                                     
remote:                For GitLab User Manual, please look into:
remote:   rastructure_user_manual/blob/master/A_Byte_of_Code_Mgmt_System-.docx
remote:                                     
remote:                                     
remote:      Any problem, please contact: Yingfu Zhou <zhouyf6@lenovo.com>
remote:                                 Lain Li
remote:                           <lidan6@lenovo.com>
remote: 
remote: ========================================================================
remote: 
remote: To create a merge request for dev_tcert, visit:
remote:   https://gitlab.lenovo.com/blockchain/backend/fabric-ca/merge_requests/new?merge_request%5Bsource_branch%5D=dev_tcert
remote: 
To git@gitlab.lenovo.com:blockchain/backend/fabric-ca.git
 * [new branch]      dev_tcert -> dev_tcert

11. 完全新写的代码部分

先copy到指定位置,然后

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git add .
root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git commit -m "create new branch dev_tcert based on v1.0.5"

root@guoqx2-ThinkCentre-E75:~/gopath/src/github.com/hyperledger/fabric-ca# git push origin dev_tcert


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值