Git使用常见问题脚本

  • receive.denyCurrentBranch

这是由于git默认拒绝了push操作,需要进行设置,修改.git/config添加如下代码:

    [receive]
    denyCurrentBranch = ignore

  或者执行

  $ git config 'receive.denyCurrentBranch' warn

在初始化远程仓库时最好使用 git --bare init   而不要使用:git init

   如果使用了git init初始化,则远程仓库的目录下,也包含work tree,当本地仓库向远程仓库push时,   如果远程仓库正在push的分支上(如果当时不在push的分支,就没有问题), 那么push后的结果不会反应在work tree上,  也即在远程仓库的目录下对应的文件还是之前的内容,必须得使用git reset --hard才能看到push后的内容.

 

 

书籍 《pro git》
;C:\Git\bin;C:\Git\mingw64\libexec\git-core
加入系统环境变量Path

配置C:\ICW\etc\profile
//增加git
export PATH="/bin:$syspath:$winpath:/cygdrive/c/git/bin:/cygdrive/c/Git/mingw64/libexec/git-core"


$ git config 'receive.denyCurrentBranch' warn



创建系统账户mygit,密码p@d2016


copssh安装账户名采用默认,但绝不能和我们创建的系统账户为同一账户,密码为p@d0000
出现错误
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:cwdShYShDYZx8vtqorZXbXbm4nO9FiKKCK4mk1X0QeE.
Please contact your system administrator.
Add correct host key in /c/Users/Administrator/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /c/Users/Administrator/.ssh/known_hosts:1
ECDSA host key for 192.168.6.116 has changed and you have requested strict checking.
Host key verification failed.

请到当前用户目录下,如当前登陆系统用户是Administrator,即到目录c:\user\administrator\.ssh下,删除known_hosts文件

git bash
ssh mygit@192.168.6.116
#输入密码,成功登陆后
执行git
报错:-bash: git: command not found
解决方法,假设COPSSH安装目录c:\ICW,打开目录c:\icw\etc,用notepad++打开profile,以避免用记事本后面会报'\r'等错误
编辑
export PATH="/bin:$syspath:$winpath:/cygdrive/c/git/bin:/cygdrive/c/Git/mingw64/libexec/git-core"

tortoiseGit URL格式
ssh://mygit@192.168.6.116/ICW/home/mygit/testgit

git clone url支持协议详细:http://blog.jobbole.com/25944/

 

posted @ 2016-04-29 12:37  jeffery1010  Views(574)  Comments(0Edit  收藏  举报