Git/安装和测试

来自康健生活
< Git
Kangkk​(留言 | 贡献)2024年2月28日 (三) 16:01的版本 (创建页面,内容为“== 测试连接 == {{Shc_out|<syntaxhighlight lang="bash"> ssh -T git@github.com</syntaxhighlight>|<syntaxhighlight lang="bash"> git@github.com: Permission denied (publickey). </syntaxhighlight>|$|/home/kangkk}} 如果是自搭建的 git 仓库,并且更改了 ssh 端口。 {{Shc_out|<syntaxhighlight lang="bash"> ssh -T git@192.168.31.5:10022</syntaxhighlight>|<syntaxhighlight lang="bash"> ssh: Could not resolve hostname 192.168.31.5:10022: nodename nor serv…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

测试连接

[jian@kang /home/kangkk]$
ssh -T git@github.com
git@github.com: Permission denied (publickey).

如果是自搭建的 git 仓库,并且更改了 ssh 端口。

[jian@kang /home/kangkk]$
ssh -T git@192.168.31.5:10022
ssh: Could not resolve hostname 192.168.31.5:10022: nodename nor servname provided, or not known

这个时候就需要更改一下写法。

[jian@kang /home/kangkk]$
ssh -p 10022 git@192.168.31.5
The authenticity of host '[192.168.31.5]:10022 ([192.168.31.5]:10022)' can't be established.
ECDSA key fingerprint is SHA256:GXLtCkYhXQ8RlHcrAyQKeTvLlBFXfWN2eBQXiou5c6I.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[192.168.31.5]:10022' (ECDSA) to the list of known hosts.
PTY allocation request failed on channel 0
Welcome to GitLab, @root!
Connection to 192.168.31.5 closed.

安装

window

linux

mac

安装 Homebrew。

➜  ~
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Warning: The Ruby Homebrew installer is now deprecated and has been rewritten in
Bash. Please migrate to the following command:
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following existing directories will be made writable by user only:
/usr/local/share/zsh
/usr/local/share/zsh/site-functions

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /bin/chmod go-w /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown -R kangjian:admin /usr/local/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 331, done.
remote: Counting objects: 100% (264/264), done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 331 (delta 203), reused 228 (delta 187), pack-reused 67
接收对象中: 100% (331/331), 146.58 KiB | 374.00 KiB/s, 完成.
处理 delta 中: 100% (213/213), 完成 64 个本地对象.
来自 https://github.com/Homebrew/brew
   663c0a713..c65bb5d12  master     -> origin/master
 * [新标签]              3.4.5      -> 3.4.5
HEAD 现在位于 c65bb5d12 Merge pull request #13094 from Homebrew/org-discussions
Updated 4 taps (homebrew/core, homebrew/cask, homebrew/services and mongodb/brew).
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

安装 git。

 
brew install git