git 和 github

分支管理

查看本地分支

git branch

查看远程分支

git branch -r

查看所有分支

git branch -a

创建分支

git branch [name]

切换分支

git checkout [name]

将新分支推送到github

git push origin [name]

删除本地分支

git branch -d [name]

删除github远程分支

git push origin :[name]

分支名前的冒号代表删除


Linux下保存 git 账号密码 [1]

通过文件方式

在用户目录 ~ 下, touch创建文件 .git-credentials

touch .git-credentials

编辑该文件,输入如下内容并保存

https://{username}:{password}@github.com

其中 usernamepassword 分别表示用户名和密码,自行替换

执行命令,将密码保存。

git config --global credential.helper store

可以看到~/.gitconfig文件,会多了一项:

[credential]
helper = store

通过缓存方式

git版本需要>=1.7.10

git config --global credential.helper cache
# 默认缓存密码15分钟,可以改得更长, 比如1小时
git config --global credential.helper 'cache --timeout=3600'

参考资料

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1. 安装 Github 查看是否安装git: $ git config --global user.name "...
    Albert_Sun阅读 14,644评论 9 163
  • 以下内容是我在学习和研究Git时,对Git操作的特性、重点和注意事项的提取、精练和总结,可以做为Git操作的字典,...
    科研者阅读 9,695评论 4 50
  • 以下内容是我在学习和研究Git时,对Git操作的特性、重点和注意事项的提取、精练和总结,可以做为Git操作的字典,...
    科研者阅读 8,884评论 2 19
  • 原文出处:涂根华的博客 一:Git是什么? Git是目前世界上最先进的分布式版本控制系统。 二:SVN与Git的最...
    挑战者666888阅读 9,923评论 6 27
  • 本片内容转自CSDN http://blog.csdn.net/ithomer/article/details/7...
    五娃儿阅读 10,346评论 2 87