git 仓库变更操作

Git global setup:

git config --global user.name "robertcheng"
git config --global user.email "robertcheng@xx.com"

代码下载:https 改为 ssh
git config --global url."git@coding.abc.com:".insteadOf "https://coding.abc.com/"。
执行结束后, 全局配置 .gitconfig相应改变如下
[url "git@coding.abc.com:"]
    insteadOf = https://coding.abc.com/
    

 当项目中某个文件, git add 提示如下失败时:
➜  schedule git:(master) ✗ git add aa.go
The following paths are ignored by one of your .gitignore files:
pkg/schedule
hint: Use -f if you really want to add them.
hint: Turn this message off by running
hint: "git config advice.addIgnoredFile false"
➜  schedule git:(master) ✗ git check-ignore -v aa.go
/Users/chengpengxing/.gitignore_global:4:schedule	aa.go
➜  schedule git:(master) ✗
➜  dbs-apiserver git:(tpaas_recover) ✗ git rev-parse --abbrev-ref HEAD
tpaas_recover
➜  dbs-apiserver git:(tpaas_recover) ✗ 
➜  dbs-apiserver git:(tpaas_recover) ✗  git log --date=iso --pretty=format:"%cd @%h" -1  // 返回最后一次提交的时间和commit id

…或在命令行上创建一个新的存储库

git clone https://coding.jd.com/stardb/aaa.git
cd aaa
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

…或从命令行推送现有空的存储库

cd existing_folder
git init
git remote add origin https://coding.jd.com/stardb/aaa.git
git add .
git commit -m "Initial commit"
git push -u origin master

…或从命令行推送已有存储库

cd existing_repo
git remote set-url origin https://coding.jd.com/stardb/aaa.git
git push --all https://coding.jd.com/stardb/aaa.git
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值