idea git 配置代理


 

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權限問題

檢查是否在當前用戶目錄下,否則沒有寫權限 

 

瀏覽器代理

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://即可

 

 

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版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_36770641/article/details/88638573

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM