天天看点

sourceforge git push -f 失败

作者:康林([email protected])

原因

  • sourceforge 上默认禁用 git push -f
  • git 库禁用 push -f,修改 conf 文件, 设置 denyNonFastforwards = true
cd .git
    vim config
           
[receive]
        denyNonFastforwards = true
           
  • git 库启用 push -f,修改 conf 文件, 设置 denyNonFastforwards = false

操作

  • 本文用的用户和项目名
    • 用户名为:kl222
    • 项目名为:virtualserialdriver
  • ssh 登录 sourceforge
    • 登录格式
    • 如果是第一次登录,用下面命令
      ssh kl222,[email protected] create
                 
    • 如果前面已经登录过了,可用下面命令
      ssh kl222,[email protected]
                 
  • 查看项目位置

    sourceforge git项目位置位于 /home/git/p/项目名

    本例项目名为 virtualserialdriver

[[email protected] ~]$ pwd
/home/users/k/kl/kl222
[[email protected] ~]$ cd /home
[[email protected] home]$ ls
frs  git  project-web  user-web  users
[[email protected] home]$ cd git
[[email protected] git]$ ls
p  u
[[email protected] git]$ cd p
[[email protected] p]$ ls
rabbitim-third-library  serialportservice    vitrualserialdriver
serialporthost          virtualserialdriver  wjy
[[email protected] p]$ cd virtualserialdriver/
[[email protected] virtualserialdriver]$ ls
code.git
[[email protected] virtualserialdriver]$ cd code.git/
[[email protected] code.git]$ ls
HEAD  branches  config  description  hooks  info  objects  refs
           
  • 修改 config 文件,把 denyNonFastforwards 改成 false
[receive]
        denyNonFastforwards = false