idea需要git操作的这样配置代理,在当前项目目录进入命令行:

配置全局参数:--global

代理 :git config --global http.proxy http://192.168.15.40:3128
取消代理: git config --global --unset http.proxy
查询是否使用:git config --global http.proxy 

 

 

git-maven仓库位置--mac linux权限问题

检查是否在当前用户目录下,否则没有写权限 

idea git 配置代理_idea

 

浏览器代理

wifi--无线网络配置代理

 

0x01 设置HTTP代理
设置全局代理模式,这里只设置了http,下载aosp项目足够用了,至于https代理没有研究

git config --global http.proxy http://127.0.0.1:8080
1
设置完后,在 ~/.gitconfig 这个文件中会找到对应配置

[http]
proxy = http://127.0.0.1:8080
1
2
不使用命令的话,直接创建并修改这个文件也可以。

0x02 取消代理
git config --global --unset http.proxy
1
0x03 HTTPS设置与取消
跟HTTP代理是一样的,只不过config对于的key是https.proxy

#设置https代理
git config --global https.proxy http://127.0.0.1:8080
1
2
#取消https代理
git config --global --unset https.proxy
1
2
当然,如果用socks协议,只需要把http://或者https://替换为socks5://即可

 

idea git 配置代理_idea_02

 

Git配置多ssh密钥:同时使用gitlab和github

如果需要同时管理自己的github上的项目和团队内部的gitlab上的项目,我们就需要配置多个ssh密钥。

使用ssh-keygen -b 1024 -r rsa命令可以生成密钥对(id_rsa,id_rsa.pub),在家目录的.ssh文件中。将公钥(id_rsa.pub中的内容)添加到gitlab(该身份对应的托管平台)上即可。

同样的,生成自己用于github的密钥对,这里命名为github_rsa、github_rsa.pub。这两对密钥对均放在.ssh文件中,这里添加一个配置文件config即可解决多密钥问题。

config文件内容如下:

Host http://***.cn/
port ****
IdentityFile /c/Users/Administrator/.ssh/id_rsa

Host github.com
IdentityFile /c/Users/Administrator/.ssh/github_rsa

此时.ssh下将有6个文件(config  github_rsa  github_rsa.pub  id_rsa  id_rsa.pub  known_hosts)。

 

如果要换个电脑工作,安装git后,可以将.ssh文件夹拷贝到新机器的用户家目录,然后执行以下命令:

git config --global user.name "123"

git config --global user.email "123@test.com"

配置完成即可。

看看当前配置,使用命令git config user.name,git config user.email。

如果添加了还是出现这个问题,那么问题大概率就定位在了你本机的这个git仓库并没有和这个SSH key 关联上。用下述方法解决:
ssh-add "你的 id-rsa 文件地址"
注意这里ssh-add后面填的是私钥地址,如mac电脑是 /Users/用户名/.ssh/id_rsa

 

ssh-add "/Users/zgq/.ssh/id_rsa_github"

add之后可以用

$ ssh git@github.com
验证是不是添加成功。
————————————————
版权声明:本文为CSDN博主「chenmeiqi777」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。