git

创建 git 仓库:

mkdir test
cd test
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/yangzonglei/test.git
git push -u origin master

已有仓库?

cd existing_git_repo
git remote add origin https://gitee.com/yangzonglei/test.git
git push -u origin master

git init  之前要把要添加的文件放到文件夹,否则,只会添加当前目录的直接目录文件 。这种情况是线上仓库是空的。

如果线上仓库有文件的,但是不是一个工程的,就是比如readme文件,init ,clone,然后再添加文件夹,其他都相同

拉去分支

git clone -b develop XXX 

之后提交就是指定分支
 

git clone直接提交用户名密码

git clone直接提交用户名和密码

git使用用户名密码clone的方式:

1

git clone http://username:password@remote

 例如:我的用户名是abc@qq.com,密码是abc123456,git地址为git@xxx.com/www.git

1

git clone http://abc@qq.com:abc123456@git.xxx.com/www.git

 执行报错:

 fatal: unable to access 'http://abc@qq.com:abc123456@git.xxx.com/www.git/':
 Couldn't resolve host 'qq.com:abc123456@git.xxx.com'

 报错原因是因为用户名包含了@符号,所以需求要把@转码一下

<?php
$userame='abc@qq.com';
echo urlencode($userame);
?>
abc%40qq.com

@符号转码后变成了%40,所以只需在clone时将username变为abc%40qq.com即可,再次执行就ok了。

为了防止密码中也可能会有@,我觉得在拼接之前,可以对用户名和密码分别进行编码操作。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值