Git Shell使用笔记
2024-09-04 00:40:25
1,首次打开Git shell错误(以前打开过gethub客户端)
警告: git command could not be found. Please create an alias or add it to your
PATH.
警告: Could not find ssh-agent
解决方法
1,close Git Shell,关闭Git Shell客户端
2,open GitHub and let it do some post installation. 这步骤是打开GitHub客户端,把里面的无效链接删除啥的,
3,Open Git Shell again and you should be fixed.打开Git Shell客户端。
参照地址:http://stackoverflow.com/questions/14950355/git-command-could-not-be-found-and-could-not-find-ssh-agent
2,在个人电脑f盘建git名文件夹,GitShell中 cd f:
,cd git
之后,在网站上new Repositoriy之后,copy项目地址,命令:
git clone https://github.com/lkdghzh/MyBackUp.git
3,git status的时候报错误,因为需要初始化:
fatal: Not a git repository (or any of the parent directories): .git
解决办法:提示说没有.git这样一个目录。输入git init
,之后git shell命令行开头就从F:\git>
变成了F:\git [master +1 ~0 -0 !]>
解释:git status命令
可以列出当前目录所有还没有被git管理的文件
和被git管理且被修改但还未提交(git commit)的文件
其实不对
,我们需要继续cd respositiry的文件夹
,
如果不继续cd respositiry的文件夹的话
,做了git init
,在respositiry的文件夹的同级会多一个.git文件夹
,
respositiry的文件夹的子文件夹还有一个.git,就不对了嘛~
clone之后的文件夹名是假如是demo,.git文件是在demo文件夹里面的。我们需要继续cd:demo,然后git status就不会报上述错误了!
这样的demo文件夹的文件(.html.css)、文件夹(js css)就下载下来了。
3.1Untracked files:git怎样删除未监视的文件untracked files
用 git clean
# 删除 untracked files
git clean -f
# 连 untracked 的目录也一起删掉
git clean -fd
# 连 gitignore 的untrack 文件/目录也一起删掉 (慎用,一般这个是用来删掉编译出来的 .o之类的文件用的)
git clean -xfd
# 在用上述 git clean 前,墙裂建议加上 -n 参数来先看看会删掉哪些文件,防止重要文件被误删
git clean -nxfd
git clean -nf
git clean -nfd
4,设置/查看用户名、邮箱
git config --global user.name "lkdghzh"
git config --global user.email "416960428@qq.com"
查看的时候把后面的用户名或者邮箱名去掉就ok
F:\git [master +2 ~0 -0 !]>
+ = Added files
~ = Modified files
- = Removed files
! = Conflicted files
后面数字我觉得应该是个数。
git 上传到网站中文编码
分支:
1查看本地分支
git branch
* master
2查看远程本地分支
git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
3本地创建分支
git branch new_branch
git branch
* master
new_branch
4本地分支推到远程分支
错误、警告
git add --a warning: LF will be replaced by CRLF in .idea/
//问题
$ git add --a
warning: LF will be replaced by CRLF in .idea/demo.iml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .idea/encodings.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .idea/misc.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .idea/modules.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .idea/vcs.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory.
//解决方案
git config core.autocrlf false
//会在.git文件夹(可能隐藏)的config文件,增加autocrlf = false。
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
autocrlf = false
[remote "origin"]
url = https://github.com/lkdghzh/demo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "new_branch"]
remote = origin
merge = refs/heads/new_branch
//可能是解决编辑器(webstorm,pythoncharm)自带生成的文件,不会提交?
git push 时候fatal: The current branch new_branch has no upstream branch
$ git push
fatal: The current branch new_branch has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin new_branch
最新文章
- WPF学习笔记——依赖属性(Dependency Property)
- Objective-C Runtime
- windows 8安装wp8之后鼠标没反应了
- Java中正则Matcher类的matches()、lookAt()和find()的区别
- [Leetcode][JAVA] Word Ladder
- Sharepoint学习笔记—习题系列--70-573习题解析 -(Q88-Q90)
- Asp.net MVC 中超链接的三个方法及比较
- 18)Java八股文名词
- openfire中mysql的前期设置
- poj1274 匈牙利算法 二分图最大匹配
- haskell Types 和 Typeclasses
- Java里的IO流里的 ObjectInputStream 的读取\写入!
- Java 中的锁——Lock接口
- MyBatis源码解析【4】反射和动态代理
- Android源码浅析(五)——关于定制系统,如何给你的Android应用系统签名
- AdminIII连接linux Postgresql过程中的几个小问题
- 剑指offer-机器人的运动范围
- Apollo 6 — ConfigService 获取配置接口
- 上传本地代码到GitHub上
- VC调试小结
热门文章
- PHP---TP框架---添加数据-----有三种方式
- OpenGL在 win8 64bits系统下的配置
- Struts2中配置默认Action
- mysql优化总结
- mysql忘记密码修改方法
- [杂] ASP.NET MVC 之 Route To MvcHandler
- Struts2中ActionContext和ServletActionContext
- 解决ClickOnce签名过期问题(转载)
- Linux常用命令_(进程管理)
- xcode命令行编译时:codesign命令,抛出“User interaction is not allowed.”异常 的处理