常用命令
1. git init
初始化一个 Git 仓库。
git init
2. git add
将文件添加到 Git 仓库中。
# 添加单个文件
git add filename
# 添加整个目录
git add directoryname
3. git commit
将当前工作目录中的更改提交到 Git 仓库中。
git commit -m "commit message"
4. git push
将本地 Git 仓库中的更改推送到远程 Git 仓库。
git push origin master
5. git pull
从远程 Git 仓库中获取最新的更改。
git pull origin master
6. git clone
克隆一个远程 Git 仓库到本地。
git clone git@github.com:username/repository.git
配置代理
在某些情况下,由于网络原因,我们可能需要使用代理服务器才能访问 Git 仓库。以下是配置代理的命令:
# 配置 HTTP 代理
git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:port
# 配置 HTTPS 代理
git config --global https.proxy https://proxyuser:proxypwd@proxy.server.com:port
参考文献:
ChatGPT
版权属于:DATA
本文链接:https://zhlblog.cn/%E7%BD%91%E7%BB%9C/64.html
转载时须注明出处及本声明