git
git 使用¶
初始化代码库
cd /path/to/your/project
# 初始化
git init
# 添加文件
git add .
# 提交代码
git commit -m "Initial commit"
# 查看工作区状态
git status
# 查看远程仓库
git remote -v
# 查看提交记录
git log --oneline
配置 github¶
首先在本地创建ssh key;
$ ssh-keygen -t rsa -C "your_email@youremail.com"
进入 Account Settings(账户配置)左边选择SSH Keys,Add SSH Key,title随便填,粘贴在你电脑上生成的key。
验证是否成功,在git bash下输入:
$ ssh -T git@github.com
获取配置
$ git config user.email
https://blog.csdn.net/yinlijun2004/article/details/53097714/
设置当前仓库
$ git config user.email aryan
设置全局
$ git config --global user.name aryan
设置username和email。
$ git config --global user.name "your name"
$ git config --global user.email "your_email@youremail.com"
$ git remote add origin git@github.com:yourName/yourRepo.git
# 设置主分支名称
git branch -M main
# 推送到远程仓库
git push -u origin main
设置代理¶
# 临时代理
git clone -c http.proxy="http://127.0.0.1:1080" https://github.com/TIGERB/easy-php.git
# 永久代理
git config --global http.proxy "http://127.0.0.1:1080"
# 查看全局配置
git config --global -l
# 取消代理配置
git config --global --unset http.proxy
本站总访问量 次