# 常用git命令 **Repository Path**: nypxzh/git ## Basic Information - **Project Name**: 常用git命令 - **Description**: git学习 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: https://gitee.com/all-about-git - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-10-28 - **Last Updated**: 2024-10-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: Git ## README # 常用git命令 设置用户名及邮箱 ``` git config --global user.name 'nypxzh' git config --global user.email 'nypxzh@qq.com' ``` 生成密钥用于同步 ``` ssh-keygen -t rsa ``` 初始化为可管理的仓库 ``` git init ``` 设置远程仓库源地址关联 ``` git remote add origin git@gitee.com:nypxzh/huma.git ``` 下载 ``` git clone git@gitee.com:nypxzh/huma.git ``` 从远程仓库目标分支拉取到本地 ``` git pull origin master ``` 推送到远程仓库的目标分支 ``` git push -u origin master ``` 填加到暂存区(.git目录) ``` git add readme.txt ``` 查看暂存区状态 ``` git status ``` 提交并附带短信息到当前本地分支 ``` git commit -m "wrote a readme file" ```