git客戶端配置使用


參考:https://www.unixhot.com/article/33 git


在騰訊軟件中心下載了git、TortoiseGit-2.10.0.0-64bit(原來在官網總下載到一半就沒反應了)docker

簡單安裝後首先在gitbash裏生成密鑰(實現ssh免密碼登陸)bash

配置用戶名
服務器

 git config --global user.name "a11"app

配置郵箱ssh

 git config --global user.email "992668717@qq.com"ide

生成密鑰對測試

 ssh-keygen -t rsa -C "992668717@qq.com"unix

複製公鑰到服務器的authorized_keysip

 cat ~/.ssh/id_rsa.pub

docker exec -it 398558f43910 /bin/sh  (進入git容器)

vi ./.ssh/authorized_keys


git客戶端使用

git clone git@172.27.14.222:/home/git/sample.git

git init

git remote add origin git@172.27.14.222:/home/git

git push -u origin master


問題:

測試克隆git上的目錄總報沒權限

git clone git@172.27.14.222:30813/home/git/sample.git

Cloning into 'sample'...

The authenticity of host '172.27.14.222 (172.27.14.222)' can't be established.

ECDSA key fingerprint is SHA256:FR1kBUsCE1Ng4hJFX6zt8nKZY8UKsU+LG0LU2mro2X0.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '172.27.14.222' (ECDSA) to the list of known hosts.

git@172.27.14.222's password:

Permission denied, please try again.

git@172.27.14.222's password:

Connection closed by 172.27.14.222 port 22

fatal: Could not read from remote repository.

原來對於服務器ssh非默認端口須要增長~/.ssh/config文件以下內容

Host:172.27.14.222

Port:30813

git clone git@172.27.14.222:/home/git/sample.git

Cloning into 'sample'...

The authenticity of host '[172.27.14.222]:30813 ([172.27.14.222]:30813)' can't be established.

ECDSA key fingerprint is SHA256:+NnZdk+KT0ipBcEJW65ryULNklH/Mb0L00hRVJhC8aQ.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '[172.27.14.222]:30813' (ECDSA) to the list of known hosts.

warning: You appear to have cloned an empty repository.

相關文章
相關標籤/搜索