Cannot commit to SVN repository via http

1,921

Solution 1

I would guess that you have SELinux turned on (normal for the default install of CentOS). I believe that the security policy for httpd forbids it accessing files outside of /var/www by default. It certainly does not allow access to /usr/local. Using /var/www/svn as the repository location will prevent access denials by SELinux.

Solution 2

You can setup SVN at SVNParentPath /usr/local/svn or any path that you want, but you have to do something.

Follow this step.

  run command 
                chcon -t httpd_sys_content_t  /usr/local/svn

Ps, - chcon is command relabels files.

- The httpd_sys_content_t type allows the httpd process to access that file.

Solution 3

Did you already create or move an existing repository directory to this location?

svnadmin create /usr/local/svn/insert_your_projectname

Then update the permissions

chown -R httpd:httpd /usr/local/svn
chmod -R 755 /usr/local/svn
service httpd restart
Share:
1,921

Related videos on Youtube

Addison
Author by

Addison

Updated on September 17, 2022

Comments

  • Addison
    Addison over 1 year

    I'm trying to make something so you enter a file name and then text to write to the file but when I try to compile it it says this:

    files.cc: In function ‘int main()’:
    files.cc:11: error: ambiguous overload for ‘operator>>’ in ‘std::cin >> filetoopen’
    /usr/include/c++/4.2.1/istream:131: note: candidates are: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>& (*)(std::basic_istream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>] <near match>
    /usr/include/c++/4.2.1/istream:135: note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_ios<_CharT, _Traits>& (*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>] <near match>
    /usr/include/c++/4.2.1/istream:142: note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>] <near match>
    /usr/include/c++/4.2.1/istream:250: note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_streambuf<_CharT, _Traits>*) [with _CharT = char, _Traits = std::char_traits<char>] <near match>
    files.cc:14: error: no match for ‘operator>>’ in ‘std::cout >> text’
    files.cc:16: error: conversion from ‘std::fstream’ to non-scalar type ‘std::ofstream’ requested
    files.cc: In function ‘char* openfile(std::fstream, char*)’:
    files.cc:21: error: no matching function for call to ‘std::basic_fstream<char, std::char_traits<char> >::open()’
    /usr/include/c++/4.2.1/fstream:780: note: candidates are: void std::basic_fstream<_CharT, _Traits>::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]
    

    #include <iostream>
    #include <fstream>
    
    using namespace std;
    
    char* openfile(ofstream file, char* words);
    
    int main()
    {
      fstream filetoopen;
      char* text;
      cout << "Enter the name of a file to write to." << endl;
      cin >> filetoopen;
      cout << "Now write somthing to the file." << endl;
      cin >> text;
      openfile(filetoopen, text);
    }
    
    char * openfile (fstream file, char* words)
    {
      file.open();
      file << words << endl;
      file.close();
    
      return words;
    }
    

    I am very new to C++ an have no idea what any of this means. Also I'm not sure if how to make a function return an array so I kinda guessed. Can any one help?

    • Ophidian
      Ophidian about 14 years
      Do you have SELinux turned on?
    • Ben Voigt
      Ben Voigt almost 12 years
      Make sure you #include <string>, to get the operators that go with it.
    • David Rodríguez - dribeas
      David Rodríguez - dribeas almost 12 years
      What is the type of filetoopen? text?
    • Ben Voigt
      Ben Voigt almost 12 years
      Add it to the question (there's an edit button). Also, you need to use std::string. Extracting to an uninitialized char* is very bad.
    • Filip Roséen - refp
      Filip Roséen - refp almost 12 years
      I've already added the code supplied by OP in a comment to the original post.
  • titaniumdecoy
    titaniumdecoy about 14 years
    Thanks for the suggestion but I am still getting the same error.
  • Nirmal
    Nirmal almost 12 years
    +1 This came handy!
  • Warwick
    Warwick over 9 years
    Got it working using the following: chcon -R --type httpd_sys_content_t /svn semanage fcontext -a --type httpd_sys_content_t '/svn(/.*)?'
  • lzdt
    lzdt almost 7 years
    I had to add on top of httpd_sys_content_t also httpd_sys_rw_content_t, only then I could commit in the new repo.