背景:电脑是mac m2,好多软件都不太兼容,安装软件成了一个问题,想着装一个SVN,跟大家一起协同开发,这下可麻烦死了,😄,终于弄明白用brew命令了,然后就用brew命令来安装,结果报错如下;
安装命令:
brew install subversion
执行完报错如下;
Error: Failed to download https://formulae.brew.sh/api/formula.jws.json!
Failed to download https://formulae.brew.sh/api/cask.jws.json!
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/api/formula.jws.json
curl: (28) Failed to connect to mirrors.ustc.edu.cn port 443 after 75015 ms: Operation timed out
==> Downloading https://formulae.brew.sh/api/formula.jws.json
curl: (28) Failed to connect to formulae.brew.sh port 443 after 262509 ms: Operation timed out
Warning: formula.jws.json: update failed, falling back to cached version.
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/api/cask.jws.json
curl: (28) Failed to connect to mirrors.ustc.edu.cn port 443 after 75013 ms: Operation timed out
==> Downloading https://formulae.brew.sh/api/cask.jws.json
curl: (28) Failed to connect to formulae.brew.sh port 443 after 262507 ms: Operation timed out
Warning: cask.jws.json: update failed, falling back to cached version.
Warning: No available formula with the name "sbversion". Did you mean subversion?
==> Searching for similarly named formulae and casks...
Warning: Error searching on GitHub: GitHub API Error: Requires authentication
The GitHub credentials in the macOS keychain may be invalid.
Clear them with:
printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
Create a GitHub personal access token:
https://github.com/settings/tokens/new?scopes=gist,repo,workflow&description=Homebrew
echo 'export HOMEBREW_GITHUB_API_TOKEN=your_token_here' >> ~/.zshrc
==> Formulae
subversion
To install subversion, run:
brew install subversion
==> Casks
session
To install session, run:
brew install --cask session
看上面的提示信息,发现,原来是token信息过期,然后它也告诉你怎么解决去了,😄
解决方法:第一步:登录你的github,在github中申请一个token信息
生成token的路径
https://github.com/settings/tokens
第二步:将你生成的token信息写到Mac的环境变量中去,仔细看报错信息,其实人家已经告诉你要把token信息写到配置文件中来了
echo 'export HOMEBREW_GITHUB_API_TOKEN=你生成的token信息放在这里' >> ~/.zshrc
然后cat一下这个文件,看看配置是否写进去了
第三步:让新配置的立即生效,刷新配置文件
source ~/.zshrc
第四步:重新执行安装命令
brew install subversion
显示如下信息
==> Fetching dependencies for subversion: apr, apr-util, gettext, lz4, and utf8proc
==> Fetching apr
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/apr-1.7.4.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
==> Fetching apr-util
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/apr-util-1.6.3.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
==> Fetching gettext
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/gettext-0.21.1.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
==> Fetching lz4
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/lz4-1.9.4.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
==> Fetching utf8proc
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/utf8proc-2.8.0.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
==> Fetching subversion
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/subversion-1.14.2_2.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
==> Installing dependencies for subversion: apr, apr-util, gettext, lz4, and utf8proc
==> Installing subversion dependency: apr
==> Pouring apr-1.7.4.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/apr/1.7.4: 59 files, 1.4MB
==> Installing subversion dependency: apr-util
==> Pouring apr-util-1.6.3.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/apr-util/1.6.3: 54 files, 891.5KB
==> Installing subversion dependency: gettext
==> Pouring gettext-0.21.1.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/gettext/0.21.1: 1,983 files, 20.9MB
==> Installing subversion dependency: lz4
==> Pouring lz4-1.9.4.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/lz4/1.9.4: 22 files, 680.0KB
==> Installing subversion dependency: utf8proc
==> Pouring utf8proc-2.8.0.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/utf8proc/2.8.0: 10 files, 768.9KB
==> Installing subversion
==> Pouring subversion-1.14.2_2.arm64_ventura.bottle.tar.gz
==> Caveats
svntools have been installed to:
/opt/homebrew/opt/subversion/libexec
The perl bindings are located in various subdirectories of:
/opt/homebrew/opt/subversion/lib/perl5
==> Summary
🍺 /opt/homebrew/Cellar/subversion/1.14.2_2: 229 files, 31MB
==> Running `brew cleanup subversion`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> subversion
svntools have been installed to:
/opt/homebrew/opt/subversion/libexec
The perl bindings are located in various subdirectories of:
/opt/homebrew/opt/subversion/lib/perl5
第五步:验证SVN是否安装成功
svn --version
提示如下信息,则表示安装成功了
svn, version 1.14.2 (r1899510)
compiled May 8 2023, 06:14:58 on arm-apple-darwin22.4.0
Copyright (C) 2022 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/
The following repository access (RA) modules are available:
* ra_svn : Module for accessing a repository using the svn network protocol.
- with Cyrus SASL authentication
- handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
- handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
- using serf 1.3.9 (compiled with 1.3.9)
- handles 'http' scheme
- handles 'https' scheme
The following authentication credential caches are available:
* Mac OS X Keychain
下面是操作的基本命令,后面在研究研究有没有可视化的界面,😄,有问题可以下方留言
1、下载SVN项目
命令行输入:svn checkout SVN的http地址
2、提交更新过的内容到SVN项目
命令行输入:svn commit -m ‘提交内容’
3、更新SVN项目内容到本地
命令行输入:svn update
4、删除在SVN项目的文件
命令行输入:svn delete SVN的http地址 -m ‘内容’
5、查看SVN信息
命令行输入:svn info
6、版本回退
命令行输入:svn checkout -r [version] SVN的http地址 你本地的文件路径
7、版本回退,只回退一个文件