ubuntu搭建svn、git遇到的问题及解决办法
不错的git笔记博客:
http://www.cnblogs.com/wanqieddy/category/406859.html
http://blog.csdn.net/zxncvb/article/details/22153019
Git学习教程(六)Git日志
http://fsjoy.blog.51cto.com/318484/245261/
图解git
http://my.oschina.net/xdev/blog/114383
Git详解之三:Git分支
http://blog.jobbole.com/25877/
情况一、
svn: /opt/svndata/repos/conf/svnserve.conf:12: Option expected
权限配置:
#分组: [groups] group_admin = wws,aaa,bbb group_user1 = sj,ccc group_user2 = sy,dd,eeee group_user3 = lxt group_user4 = ss #设置对根(即SVN)目录下,所有版本库的访问权限 [/] * = r #所有登录用户默认权限为只读 @group_admin = rw #可以分配给组,该组有读写权限 wws = rw #也可以像这样分配给指定用户 在修改配置文件(authz)后,客户端可能会报“Invalid authz configuration”的错误提示! 客户端没有提示错误原因,但在服务器端有一个方法,可以检查配置文件(authz)错在了哪里; 具体方法如下: root@server:~# svnauthz-validate /data/svn/LQPLAY/conf/authz svnauthz-validate: /data/svn/LQPLAY/conf/authz:167: Option must end with ':' or '=' 它查出了是配置文件(authz)的第167行,出现了错误。 然后,可以用如下命令,编辑它并保存: root@server:~# vi /data/svn/LQPLAY/conf/authz Shift+: set number (显示行号) Shift+: 167 (直接跳转到167行) 我发现是本该写为(gaojs = rw),不小心写成了(gaojs - rw)。 字母键(I-Insert),从浏览模式,切换到插入模式; (Shift+:, 从浏览模式,切换到底行命令模式) (Esc,从其他模式,退出到浏览模式) 修改后保存退出! Shift+: wq (Write & Quit)
情况二、SVN的“Invalid authz configuration”错误的解决方法
转自:http://blog.csdn.net/gaojinshan/article/details/18218009
查看SVN的目录在哪里?
root@server:~# whereis svn
svn: /usr/bin/svn /usr/bin/X11/svn /usr/share/man/man1/svn.1.gz
查看SVN的进程是哪些?
root@server:~# ps aux | grep svn
root 1527 0.0 0.0 69640 1092 ? Ss 10:53 0:00 svnserve -d -r /data/svn/LQPLAY
root 5144 0.0 0.0 13592 936 pts/2 S+ 11:58 0:00 grep --color=auto svn
启动SVN的服务(-d:Deamon; -r:Root)
root@server:~# svnserve -d -r /data/svn/LQPLAY
查看SVN的服务是否正常(端口号3690是否存在)
root@server:~# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 1527/svnserve
1、checkout时,提示:URL svn://192.168.1.99/svntest doesn't exist...
奇怪,怎么会提示库不存在呢?肯定是哪里配置问题。后来尝试了半天,也在网上搜索了很久,终于发现问题所在。
如果你的svn库的路径为:/home/svn/svntest
那么你启动时,不能用命令:
1
|
svnserve -d -r /home/svn/svntest
|
而要用命令:
1
|
svnserve -d -r /home/svn/
|
2、commit时,提示:Authorization failed
开始一直以为是authz文件配置得不对,一直尝试,一直修改,还是不行,郁闷了。在确定authz的配置完全没问题后,开始查其它两个配置文件的问题。后来终于发现问题出在svnserve.conf这个文件。以下四行:
1
2
3
4
|
# anon-access = read
# auth-access = write
# password-db = passwd
# authz-db = authz
|
是被注释掉的,虽然文件说明里面说默认就是按注释掉的配置来执行,但好像并不是这样。放开注释:
1
2
3
4
|
anon-access = read
auth-access = write
password-db = passwd
authz-db = authz
|
问题解决。
PS:有些童鞋问文件上传到服务器后存放在服务器的哪个地方。
答:一般放在/home/svn/svntest/db/revs(根据我自己的目录结构)里面
svn: No repository found in 'svn:..解决方案
svn服务未启动或者是启动的时候未指定svn仓库路径
使用如下命令:
sudo svnserve -d -r /var/svn
后面的目录是你svn服务的仓库路径
另外要使用sudo取得管理员权限,否则可能在提交代码的时候出现权限问题
git commit命令的使用与git默认编辑器的修改
1、git commit
此时是进入GUN nano编辑器。在这里可以添加你的commit imformation 然后ctrl+o,回车保存,再ctrl+x退出。
因为对Nano编辑器很不熟悉,在这里我想将默认编辑器改为vim。打开.git/config文件,在core中添加 editor=vim即可。
或者运行命令 git config –global core.editor vim 修改更加方便。
2、git commit -a
把所有add了的文件都加入commit,然后进入编辑器编辑commit信息。
3、git commit -m “commit imformation”
直接在后面添加commit 信息然后提交commit,与gitcommit相比快捷方便,但是就是commit信息格式无法控制。
4、git commit --amend
修改最后一次commit的信息
git config运用
"remote:error:refusing to update checked out branch:refs/heads/master"的解决办法
在使用Git Push代码到数据仓库时,提示如下错误:
[remote rejected] master -> master (branch is currently checked out)
错误原型
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To git@192.168.1.X:/var/git.server/.../web
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'git@192.168.1.X:/var/git.server/.../web'
解决办法:
这是由于git默认拒绝了push操作,需要进行设置,修改.git/config文件后面添加如下代码:
[receive]
denyCurrentBranch = ignore
无法查看push后的git中文件的原因与解决方法
在初始化远程仓库时最好使用
git --bare init
而不要使用:git init
git init 和git --bare init 的具体区别:http://blog.haohtml.com/archives/12265
=================================================
如果使用了git init初始化,则远程仓库的目录下,也包含work tree,当本地仓库向远程仓库push时, 如果远程仓库正在push的分支上(如果当时不在push的分支,就没有问题), 那么push后的结果不会反应在work tree上, 也即在远程仓库的目录下对应的文件还是之前的内容。
解决方法:
必须得使用命令 git reset --hard 才能看到push后的内容.
研究了很久不得其解,然后找到一条命令凑合着能用了:
git config --bool core.bare true
就搞定了。
贴一段参考文章:
Create a bare GIT repository
A small rant: git is unable to create a normal bare repository by itself. Stupid git indeed.
To be precise, it is not possible to clone empty repositories. So an empty repository is a useless repository. Indeed, you normally create an empty repository and immediately fill it:
git init git add .
However, git add is not possible when you create a bare repository:
git --bare init git add .
gives an error "fatal: This operation must be run in a work tree".
You can't check it out either:
Initialized empty Git repository in /home/user/myrepos/.git/ fatal: http://repository.example.org/projects/myrepos.git/info/refs not found: did you run git update-server-info on the server? git --bare init git update-server-info # this creates the info/refs file chown -R <user>:<group> . # make sure others can update the repository
The solution is to create another repository elsewhere, add a file in that repository and, push it to the bare repository.
mkdir temp; cd temp git init touch .gitignore git add .gitignore git commit -m "Initial commit" git push <url or path of bare repository> master cd ..; rm -rf temp
git diff 无效的解决
转自:http://blog.csdn.net/rainysia/article/details/49463753
昨天打算把git diff 关联上bcompare作两个文件对比, 后来发现不怎么好用. 还要弹个gtk的窗口. 于是unset了后.
今天重新git diff的时候, 发现输入后没有任何反应. 就记录下怎么修复的
找了一台可以用git diff的机器, 随便echo 了一个多余的字符进已有的repository, 这里我们用strace来追踪执行过程.
#strace -f -e execve git diff
execve("/usr/bin/git", ["git", "diff"], [/* 45 vars */]) = 0 Process 27865 attached [pid 27865] execve("/usr/lib/git-core/pager", ["pager"], [/* 49 vars */]) = -1 ENOENT (No such file or directory) [pid 27865] execve("/usr/local/bin/pager", ["pager"], [/* 49 vars */]) = -1 ENOENT (No such file or directory) [pid 27865] execve("/usr/bin/pager", ["pager"], [/* 49 vars */]) = 0 diff --git a/fabfile.py b/fabfile.py index e53e07a..0974ee9 100644 --- a/fabfile.py +++ b/fabfile.py @@ -176,3 +176,4 @@ def test(version='', by='TAG'): _push_rpm(rpmfile=rpmfile) # done return +122 [pid 27865] +++ exited with 0 +++ --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=27865, si_uid=1000, si_status=0, si_utime=0, si_stime=0} --- +++ exited with 0 +++
再看看不能执行的
#strace -f -e execve git diff
execve("/usr/bin/git", ["git", "diff"], [/* 44 vars */]) = 0 Process 20460 attached [pid 20460] execve("/usr/lib/git-core/less", ["less"], [/* 47 vars */]) = -1 ENOENT (No such file or directory) [pid 20460] execve("/usr/local/bin/less", ["less"], [/* 47 vars */]) = -1 ENOENT (No such file or directory) [pid 20460] execve("/usr/bin/less", ["less"], [/* 47 vars */]) = 0 [pid 20460] +++ exited with 0 +++ --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20460, si_uid=1000, si_status=0, si_utime=0, si_stime=0} --- +++ exited with 0 +++
原来是正常的pager给换成了less.
这就简单了,找了下/etc/gitconfig. /root/.gitconfig, /home/username/.gitconfig 以及项目下的.git/config 都没有发现alias pager=less的. 看看git config –list 也没有定义.
想起来改过bashrc, 打开一看, 果然
export PAGER=less
删掉后重新加载terminal, git diff就恢复了正常.
Double Hyphens in Git Diff
转自:http://www.microsofttranslator.com/bv.aspx?ref=SERP&br=ro&mkt=zh-CN&dl=zh&lp=EN_ZH-CHS&a=http%3a%2f%2fvincenttam.github.io%2fblog%2f2014%2f08%2f07%2fdouble-hyphens-in-git-diff%2f
Two months ago, I wrote my first list of Git commands, and said that I didn’t know how to use Git commands to view the changes.1
Now, I can understand how one can “use ‘--
’ to separate paths from revisions [or branches]”.
For example, if a developer relies on this Git cheatsheet for blogging with Octopress, then he/she will learn some Git commands, for example:
git diff <branch>
to view the uncommitted changes;git diff <path>
to show the uncommitted changes in files under<path>
.
Those commands should be enough for most cases. However, if he/she blogs with Octopress, then he/she will encounter the some problems:
git diff source
can’t view the uncommitted changes onsource
branch; (Click the linked post in footnote 1 for the error thrown by Git.)git diff source
can’t show the uncommitted changes in files undersource
folder.
In order to use git diff
to do the intended task, one has to avoid ambiguity.
- If necessary, one can use
--
to separate branch name(s) from file/path names; - 一个可以使用
./source
到平均source
文件夹。
$ git diff origin/source source
fatal: ambiguous argument 'source': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
$ git diff origin/source source -- # correct command
$ git diff ./source # correct command
如果一个想要在 shell 命令中键入,其中一个可以考虑使用fugitive.vim: 在一个窗口由调用:Gst
,在修改后的文件在哪里显示的线按D
。
将本地test分支push到远程仓库上,如果远程没有就会创建
git push origin test
git checkout test -------》将远程的test分支下载到本地
git checkout -b aa origin/test -----》 将远程的test分支下载到本地,并且切换到本地
本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/sky-heaven/p/5186591.html,如需转载请自行联系原作者
ubuntu搭建svn、git遇到的问题及解决办法相关推荐
- Ubuntu搭建SVN服务 - 内网穿透实现公网远程访问
写在前面:博主是一只经过实战开发历练后投身培训事业的"小山猪",昵称取自动画片<狮子王>中的"彭彭",总是以乐观.积极的心态对待周边的事物.本人的技 ...
- 《视觉SLAM十四讲》第四讲-ubuntu下安装Sophus库出现问题及解决办法
这里写自定义目录标题 写在前面 1.安装指令: 2.编译过程中出现的问题及解决办法: 问题1: 问题2: 3.使用过程中出现的问题 参考链接 写在前面 本文转载自: [1] haxiongha. ub ...
- git merge git pull时候遇到冲突解决办法git stash
git merge git pull时候遇到冲突解决办法git stash 在使用git pull代码时,经常会碰到有冲突的情况,提示如下信息: error: Your local changes t ...
- Git常见错误(附解决办法)
目录 1.Unable to create 'F:/Git/.git/index.lock': File exists. 2.committing is not possible because yo ...
- Ubuntu 修改mysql存放路径后无法启动解决办法
Ubuntu 修改mysql存放路径后无法启动解决办法: # vi /etc/apparmor.d/usr.sbin.mysqld # /var/lib/mysql/ r, (即注释掉该行) 改为 / ...
- LinuxMint/Ubuntu 关机重启等待 90 秒问题的解决办法
LinuxMint/Ubuntu 关机重启等待 90 秒问题的解决办法 参考文章: (1)LinuxMint/Ubuntu 关机重启等待 90 秒问题的解决办法 (2)https://www.cnbl ...
- 有关阿里云服务器ping不通解决办法(云服务器搭建完环境访问不了ip解决办法)
阿里云服务器ping不通解决办法(云服务器搭建完环境访问不了ip解决办法) 问题:这里的服务器我以阿里云为例,学生套餐嘛,便宜,最近搞服务器,然后Ubuntu16.04下搭建LAMP环境后发现输入ip ...
- Ubuntu不能打开设置(Setting)的解决办法
Ubuntu不能打开设置(Setting)的解决办法 参考 方法1(自己用过后有效): 命令: 完全恢复Ubuntu的桌面设置,这样就可以让Dock重新恢复到左侧位置,执行如下命令: dconf re ...
- eclipse使用git提交无反应的解决办法
eclipse使用git提交无反应的解决办法 目前eclipse大都是集成了git插件的,无需另外下载,本文讲述以此为前提,解决eclipse上传git过程中出现的问题 话不多说,看步骤: 1.在gi ...
最新文章
- c python.h_C++/C语言Python H
- memcached 分布式 一致性hash算法demo
- SqlServer 2014 还原数据库时提示:操作系统返回了错误5,,拒绝访问
- Android webView 缓存 Cache + HTML5离线功能 解决
- scrapy在命令行指定要采集的url
- 帮你少写一大半参数校验代码的小技巧
- 程序员每天晚上都去翻垃圾,竟然年入60万美元?
- supervisor详解
- 数学建模更新7(ARCH和GARCH模型)
- Java视频教程,最新全套Java教程!
- Web端与移动端接入萤石云平台的视频数据
- 面试题 - 头条、京东
- Gradle 配置阿里云代理 https,maven central 中央仓库,google,gradle plugin,jcenter
- 如何挑选文档管理软件?
- 对Java.io中一些类的归纳,层次结构图
- c程序设计语言布莱恩克尼汉,《C程序设计语言(第2版新版)典藏版》 —1.5.4 单词计数...
- 规避三方工具带给产品的潜在风险
- 苹果IOS端游戏试玩操作方法和攻略
- HDUOJ 1281 棋盘游戏
- 《翻转式学习——传统教育弊端》分享