git常用命令

解决gitignore不生效问题

git rm -r --cached .

git add .

git commit -m 'update .gitignore'

使用命令,本地推送到远程地址

git init # 把项目初始化,相当于在项目的跟目录生成一个 .git 目录

git add . # 把项目的所有文件加入暂存区

git commit -am '项目初始化' # 把项目提交到本地仓库,引号里面的是这次提交的注释,方便以后查看。

git remote add origin xxx.git #为本地的仓库创建一个远程仓库.

git pull --rebase origin master # 把远端仓库中的代码 拉到本地进得合并一下。

git config --global user.name "weiruibai"

git config --global user.password "wrb202305!!"

查看用户名 :git config user.name

查看密码: git config user.password

查看邮箱:git config user.email

查看配置信息: $ git config --list

命令行指令

Git 全局设置
复制代码
git config --global user.name "管理员"
git config --global user.email "admin@example.com"
创建新版本库
复制代码
git clone http://47.106.79.29:9999/root/tangxi-v2-java.git
cd tangxi-v2-java
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
已存在的文件夹
复制代码
cd existing_folder
git init
git remote add origin http://xxxxx:54/xxx.git
git add .
git commit -m "Initial commit"
git push -u origin master
已存在的 Git 版本库
复制代码
cd existing_repo
git remote rename origin old-origin
git remote add origin http://xxxxx:54/xxx.git
git push -u origin --all
git push -u origin --tags

如果报403,执行

复制代码
git config --system --unset credential.helper
相关推荐
奶茶树1 小时前
【C++】13. C++11新特性【上】
c语言·开发语言·c++·git·github
夏至春来-美美16 小时前
git clone报错
git
拂拉氏16 小时前
【Linux】 开发工具(Makefile、git、cgdb)解析与对于操作系统的基础认识
linux·git·操作系统·makefile·cgdb
番茄不是西红柿kk1 天前
deepseek-harness跨平台桌面端二开项目(附git仓库地址+安装包)
git·agent·codex·deepseek·deepseekharness
leoZ2311 天前
10-Git 仓库蒸馏术:从代码仓库到 OpenClaw 虚拟人-蒸馏工具链
大数据·git·深度学习·神经网络·目标检测·elasticsearch·lstm
fpcc2 天前
工具使用—git diff命令分析说明
git·工具
console.log('npc')2 天前
Git 删除指定提交记录操作指南
git
随风丶飘2 天前
[特殊字符] 告别“update“和“fix bug“——Smart Git Commit LLM 让 AI 帮你写专业的 Git 提交信息
人工智能·git·bug
yanlaifan2 天前
git clone时候指定换行符
git
小小安于乱2 天前
解决IDEA的git插件pull代码冲突但右下角不提示消息问题
java·git·intellij-idea