git推送报错: No path specified. See 'man git-pull' for valid url syntax或does not appear to be a git repository以及remote: error: insufficient permission for adding an object to repository databa
本地(windows)代码想推送到linux自己搭建的git服务端,第一步是建立本地与服务端的关联,第二步是本地推送到服务端。
第一步需要看你的本地工程是否从git上clone来的,如果是clone来的那就不存在第一步了。如果是本地已经有了工程之后才想同步到git上,那么需要先到linux的git目录下新增同名git仓库并初始化。这里以ms-util工程为例:
cd git
mkdir ms-util.git
cd ms-util.git
git --bare init
接着修改用户属主和用户组属主(这里用户和用户组我们都用git),并让git仓库有执行权限:
cd ..
chgrp git ms-util.git -R
chown git ms-util.git
chmod ms-util.git
搞完上面这两步后用ll命令看到的应该是这样的:
drwxrwxr-x git git Mar : ms-util.git
搞完服务端接着搞本地客户端,打开本地windows下的git bash:
cd workspace/ms-util
git init
git remote add origin ssh://111.11.111.11/git/ms-util.git
这样就建立了本地客户端与远程git服务端的连接了,本地的git仓库ms-uitl就可以push给服务端的同名git仓库了。但此时我们本地配置的远程url的路径不对,所以会报如下错误:
git push -u origin master
fatal: No path specified. See 'man git-pull' for valid url syntax
告诉你没有url链接,或者会说url不是一个仓库:
git push -u origin master
fatal: '/git/ms-util.git' does not appear to be a git repository
fatal: Could not read from remote repository.
那么正确的git链接长啥样呢?可以先在本地客户端执行如下命令来参考下
git remote -v
origin ssh://111.11.111.11:ms-util.git (fetch)
origin ssh://111.11.111.11:ms-util.git (push)
从上面命令结果看,该远程url没有加入用户,我们自己加(还记得上面我们设置的用户git吗?)。重新关联服务端git之前,先把老的url删掉
git remote rm origin
git remote add origin git@111.11.111.11:ms-util.git
这样第一步就结束了,第二步的问题也就来了:
$ git push -u origin master
Counting objects: , done.
Delta compression using up to threads.
Compressing objects: % (/), done.
Writing objects: % (/), 3.48 KiB | 891.00 KiB/s, done.
Total (delta ), reused (delta )
remote: error: insufficient permission for adding an object to repository databa se ./objects
remote: fatal: failed to write object
error: remote unpack failed: unpack-objects abnormal exit
To 111.11.111.11:ms-util.git
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'git@111.11.111.11:ms-util.git'
其实第二步的问题在设置第一步时已经埋下了。还记得这两条命令吗:
chown git ms-util.git
chmod ms-util.git
它们少了一个参数-R,导致ms-util.git里的用户和权限不对,自然无法在客户端push时写入服务端了。解决办法也很简单:进入linux下git目录
chown -R git ms-util.git
chmod -R ms-util.git
这时再回到windows下用git bash就可以push了:
git push -u origin master
Counting objects: , done.
Delta compression using up to threads.
Compressing objects: % (/), done.
Writing objects: % (/), 3.48 KiB | 891.00 KiB/s, done.
Total (delta ), reused (delta )
To 116.62.136.56:ms-util.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
以后再push无需再加上-u重新配置了。
git推送报错: No path specified. See 'man git-pull' for valid url syntax或does not appear to be a git repository以及remote: error: insufficient permission for adding an object to repository databa的更多相关文章
- jenkins报错: error: insufficient permission for adding an object to repository database .git/objects
前言:这是在用jenkins去gitlab上面去拉下代码来编译,就报了这个错,在这里记录下,避免下次 报错: 17:08:17 error: insufficient permission for ...
- git 报错 error: insufficient permission for adding an object to repository database ./objects
参照:http://stackoverflow.com/questions/1918524/error-pushing-to-github-insufficient-permission-for-ad ...
- git push error:error: insufficient permission for adding an object to repository database ./object解决
在服务器代码库xxx.git文件夹中:1.sudo chmod -R g+ws *2.sudo chgrp -R mygroup * //mygroup是该文件夹的所有组3.git repo-conf ...
- git 权限问题:insufficient permission for adding an object to repository database .git
在git pull 的时候报错:insufficient permission for adding an object to repository database .git (去仓库里的objec ...
- Git报错:insufficient permission for adding an object to repository database .git/objects
在本地搭建Git服务器后,在开发机上push新代码,发现Git提示: insufficient permission for adding an object to repository databa ...
- [Git] 解决 insufficient permission for adding an object to repository database
[环境] OS: CentOS 6.5 Git: 1.7.1 [症状描述] Git 中心仓库路径 ~/project.git,克隆库路径 ~/project.clone,克隆库中包含一个文件 ~/pr ...
- git push不成功 insufficient permission for adding an object to repository database
这常见于多用户. 1. 确保所有用户在同一个组: 2. 确保所有文件被组可读写. 当多个用户各自进行了push操作后,object目录下的文件可能各自属于各个用户.
- iOS 消息推送报错NSCocoaErrorDomain Code=3000
转自: http://www.cnblogs.com/zxykit/p/5207498.html Xcode7推送报错.Error Domain=NSCocoaErrorDomain Code=300 ...
- SpringMVC整合极光推送报错ClassNotFound
问题: 今天在做后台和极光整合的过程中,将极光部分代码整合到Dao层,在启动项目的过程中总是报错,classNotFund cn/jpush/api/push/xxxx 极光官方文档: http:// ...
随机推荐
- P2831 愤怒的小鸟(状压dp)
P2831 愤怒的小鸟 我们先预处理出每个猪两两之间(设为$u,v$)和原点三点确定的抛物线(当两只猪横坐标相等时显然无解) 处理出$u,v$确定的抛物线一共可以经过多少点,记为$lines[u][v ...
- Django快速搭建博客系统
Django快速搭建博客系统 一.开发环境 Windows 7(64bit) python 3.6 https://www.python.org/ Django 2.0 https://www. ...
- [nowcoder]contest/172/C保护
C国有n个城市,城市间通过一个树形结构形成一个连通图.城市编号为1到n,其中1号城市为首都.国家有m支军队,分别守卫一条路径的城市.具体来说,对于军队i,他守卫的城市区域可以由一对二元组(xi,yi) ...
- atcoder ARC092 D - Two Sequences 二分 & 二进制
今天生日捏,嘻嘻~ 题意:给定A B数组长度为n 求所有 (1<=i,j <=n ) a[i]+b[j] 的异或和. n <=200000 ai bi <=228 这题比赛没 ...
- R语言笔记-set.seed()函数
今天查了一下R语言中set.seed(),该命令的作用是设定生成随机数的种子,种子是为了让结果具有重复性.如果不设定种子,生成的随机数无法重现. set.seed()用于设定随机数种子,一个特定的种子 ...
- Shell脚本之无限循环的两种方法
for #!/bin/bash ;i<;)) do let "j=j+1" echo "-------------j is $j ----------------- ...
- oracle RAC的客户端HA配置
在ORACLE 9i RAC 环境下,为了做到高可用性,需要对客户端的tnsnames.ora这个文件进行配置,在oracle中这样的配置叫做TAF,这个配置不能使用NETCA配置程序生成.其中ORA ...
- JS级联下拉框
//Ajax级联获取SDKfunction GetDropDownList(parent_ddlID, fill_dllID, url, param) { this.pId = parent_d ...
- ExtJS 6 如何引入Dashboard模版
最近很多人问我在ext js 6+的版本中怎么引入官方的dashboard模版,正好我好久没写博客了,这里我写一篇博客来说明一下. 在这里以ext js 6.2.1版本为例(注:需要安装Sencha ...
- 改变Vim保存文件路径
1. vim 有个cd命令.用来更改当前文件夹.:cd sth进入sth文件夹.这样新文件保存之后就在当前文件夹.不过如果你打开一个已经保存的文件后然后更改当前文件夹是不会改变保存路径的.你必须为:w ...