git指定用户名或token下载,从指定分支拉取代码并上传到指定分支

指定用户名下载  密码中如果有某些符号如'>',我们需给他编码'%3E'

git clone https://username:password@github.com/xxx.git

 

指定token下载   附带代理(生成token时一定要保存,否则以后看不到的)

git clone https://token@github.com/xxx.git --config "http.proxy=http://xxx.com:911"

  

 

从指定分支拉取代码

git clone -b 分支名  https://token@github.com/xxx.git

  

推送到指定分支

git pull origin 分支名
git push origin 分支名

  

设置代理

有些内网下载代码时需要设置代理,否则拉取代码会报错

bash-4.2# git config --global https.proxy 'http://xxx.com:913'
bash-4.2# git config --global http.proxy 'http://xxx.com:913'

 

 

编码解码:

>>> import urllib
>>> urllib.parse.quote(">")
'%3E'
>>> urllib.parse.quote("<")
'%3C'
>>> urllib.parse.unquote("%3E")
'>'
>>> urllib.parse.unquote("%3C")
'<'
>>>

 

posted @ 2023-06-02 14:37  腹肌猿  阅读(1078)  评论(0编辑  收藏  举报