Git工具http://www.Sina.com/gitgithubgitee版本控制代码仓库
Git是目前流行的版本控制软件,其目的是文件的版本控制。
github、gitee是代码托管站点,通常用于托管、开放源代码。 全球资讯科技
它也是用于管理和克隆本地和远程仓库的实际跨平台软件工具。
关键词:
Git安装Git基本使用Git常规命令使用Git时遇到的问题主要内容:
官方doc 3359 git-SCM.com/doc http://www.Sina.com/https://Taotao DIY-Linux.readthedocs.io/en/latest/env/git.htthed
用Git安装Git软件将本地代码仓库与远程仓库关联起来,在命令行上实现了代码上传下载、版本控制。
首先,必须在代码托管站点创建帐户,安装git软件,并配置适当的环境(
SSH )。
注册github/gitee帐户github https://github.com/访问缓慢
gitee https://gitee.com/下载速度相对较快
安装Git软件Windows :
Git客户端下载https://www.git-scm.com/downloads
默认安装可以。 通常,安装后按鼠标右键会添加Git GUI Here/Git Bash Here。
Git Bash Here是一个Windows命令行工具,界面如下:
Ubuntu:
Ubuntu通过命令直接安装,
apt-get安装git
设置SSH以打开git工具,然后输入: 所有其他都是默认设置。
sh-keygen-trsa-c ' XXX @ XXX.com '//XXX @ XXX.com在您的邮箱中,找到生成的SSH私钥并将其添加到github/gitee中。
cd ~/.ssh //切换目录默认为/c/Users/xxx/xxx为计算机用户名ls//id_RSAid_RSA.pubid_RSA.pub为公钥cat id _ pub
做仓库其实很灵活,这里云直接做仓库,表示克隆人要去当地。
要创建远程仓库,请先登录github/gitee,然后手动创建仓库。
填写仓库名称、路径、概要等的语言根据仓库保管的文件决定; 选择是否为开源,即是否允许他人访问、下载;
关于
开源许可证
请参考这里。 软件的开源通常推荐最新版的GPL,文档的开源则推荐
有关GNU自由文档的许可证,请单击“创建”。
每个开源项目通常都有一个自述文件,介绍本项目是什么、要做什么以及如何使用,并建议添加。
以下是这一系列博客的开源地址,欢迎使用克隆。 当然也请尊重作者的权益。
代码仓库: https://gitee.com/bluse Li/Taotao DIY
文档参考:
要本地克隆仓库,必须首先通过git客户端登录。
//xxx是您的github/gitee/gitlab帐户git config-- global user.name ' XXX '//XXX @ XXX.com为您提供github/gitee/gigitex
仓库地址(https或ssh ) :
git clone https://gitee.com/bluse Li/Taotao DIY.git
现在已经创建了仓库,克隆完成了。 可以在此仓库中添加/删除文件并重新评估,以不定期地与远程同步。
通常,在本地仓库上载期间运行以下命令,并添加相应的注释以同步到远程仓库:
git add .//添加此次提交的评论git commit -m '更新xxx内容//更改远程仓库git push Git全局设置: git config----全球用户. name ' taotaaation
dgit commit -m "first commit"git remote add origin https://gitee.com/taotaodiy/test.gitgit push -u origin master已有仓库?cd existing_git_repogit remote add origin https://gitee.com/taotaodiy/test.gitgit push -u origin master Git 常用命令 切换分支 //列出所有分支git branch -a //切换到xxx分支git checkout xxx 删除分支 //删除本地分支branch_namegit branch -d branch_name 克隆指定分支 //xxx 你要克隆的分支 url 仓库地址git clone --branch xxx url 恢复到上一次提交 //查看git的提交版本和id 执行结果会显示历史记录git log //恢复到指定版本 pre_id指定你要恢复的idgit reset --hard pre_id//如 git reset --hard 4a28f1cc1e27bb1870d8966a09ca87eb7ef21095 强制提交到仓库 //强制提交到mastergit push -f origin master//强制提交到分支 branch_name 为远程分支git push origin branch_name --force 创建分支并提交到新分支 //branch_name 为远程分支git checkout -b branch_name//查看分支git branch //提交到新分支git push origin branch_name//必要时为此分支创建跟踪信息git branch --set-upstream-to=origin/branch_name 强制拉取仓库 git fetch --allgit reset --hard master git pull 被仓库拒绝提交remote: You do not have permission push to this repository
remote: Permission to xxxxx.git denied to xxxxx.
git config --global user.name userA git config --global user.email
userA@Email.com
git config credential.username UserB git push origin master
git:‘credential-osxkeychain’ 不是一个 git 命令。参见 ‘git
–help’。 git:‘credential-wincred’ 不是一个 git 命令。参见 ‘git
–help’。
git config --unset-all credential.helper git config --global
credential.helper store
remote: Invalid username or password. fatal: Authentication failed for
‘xxxxx’
Incorrect username or password (access token)
git config --global user.name userA git config --global user.email
userA@Email.com
git config credential.username UserB git push origin master
push 被拒绝error: failed to push some refs to
‘https://gitee.com/taotaodiy/taotaodiy.git’
remote: error: GE007: Your push would publish a private email address.
邮箱管理,取消勾选,不公开我的邮箱地址
提交时候很多警告The file will have its original line endings in your working directory.
git config --global core.autocrlf false
修改远程仓库https://blog.csdn.net/LonewoIf/article/details/102385511
美满的啤酒:使用命令先删再增 第一步:先删除你的远程仓库 git remote rm origin
第二步:再添加远程仓库 git remote add origin [url]
注意:如果有其他分支修改后需要重新拉去一下远程分支 git fetch
平淡的砖头:使用命令修改 git remote origin set-url [url]
方法三:直接修改你本地的.git文件
进入.git文件夹,编辑.git文件中的config文件,修改config文件中的url路径为新的远程仓库地址路径。
gnutls_handshake() failed error in the pull function
------------------------------
https://zhidao.baidu.com/question/757951548187962084.html
git verify-pack -v .git/objects/pack/pack-*.idx | sort -k 3 -g | tail
-3
再次克隆,不再提示输入账号密码,直接拒绝
window window凭据 然后删除该仓库的记录,再次克隆
Git 补丁git 生成patch和打patch
参考 https://taotaodiy-yocto.readthedocs.io/en/latest/yocto/yocto_patch_linuxfb.html
管理多个 Git 工程https://taotaodiy-linux.readthedocs.io/en/latest/env/repo.html
git 问题这里是我使用git遇到的一些问题和解决办法,记录到这里,不定时更新
原文链接https://taotaodiy-linux.readthedocs.io/en/latest/env/git.html