svn import is giving error - linux

i am working on svn project and i am totally newbie.i am learning SVN from tutorialspoint. i have create repository successfully. and created directories for trunk, branches and tags using following commands
mkdir /tmp/svn-template
mkdir /tmp/svn-template/trunk
mkdir /tmp/svn-template/branches
mkdir /tmp/svn-template/tags
now i want to import that dir to my repository using following command
svn import -m 'Create trunk, branches, tags directory structure' /tmp/svn-template/
but it gives me an error "
svn: E205000: Try 'svn help' for more info
svn: E205000: Invalid URL '/root/tmp/svn-template'
"
please help me guys

You forgot to specify the last argument, your repository URL.
For example:
svn import -m 'Create ...' /tmp/svn-template/ http://svn.myserver.com/repo/svn-template/
Be aware that your local copy will not be under version control after that. You must make a checkout of a working copy in another directory.
cd /somewhere/else
svn checkout http://svn.myserver.com/repo/svn-template/

change the SVNPath in /etc/httpd/conf.d/subversion.conf
to "SVNPath /var/www/svn/your_project_name"
cd /var/www/svn
Now import the dir /tmp/svn-template
svn import /tmp/svn-template/ http://ip-address/svn/ -m "Create trunk,branches and tags directories"

Related

How to manage files of link source by git?

Want
I wanna manage nvim config by git.
Problem
Link is break by git checkout . command. Expect behavior is overwrite my nvim config with remote repository source. But actual behavior is overwrite link with remote repository source.
Code
I was tried as bellow code.
# clone
cd ~/Documents/GitHub/
git clone https://github.com/ShortArrow/my-nvim-config
cd my-nvim-config
# delete "./nvim" for making link
rm -r ./nvim
# making link
ln -s ~/.config/nvim/ ./nvim
# if you need, "cp ~/.config/nvim/ ~/.config/nvim-backup"
# I wanna rewrite nvim config by git with this command
git checkout .
Already Tried
try1
sudo git config --system --unset core.symlinks
git config --local core.symlinks false
try2
$> sudo ln -d ~/.config/nvim/ ./nvim
ln: failed to create hard link './nvim' => '/home/who/.config/nvim/': Operation not permitted
On Windows
This github repository is working good with Junction link on Windows.
A softlink is just a file with the target path in it (and a permission flag telling the OS to treat it as a link), and Git is treating it as such.
Instead of changing what is in the repository by changing the repository file into a link to the config file, link the other way: make the config file link into the repository.

How can I access the trunk directory of a new Subversion repository?

I created a Subversion repository along with branches, tags and trunk directories with:
svnadmin create file:///home/user/public_html/repo/myrepo
svn mkdir file:///home/user/public_html/repo/myrepo/tags -m "tags created"
svn mkdir file:///home/user/public_html/repo/myrepo/branches -m "branches created"
svn mkdir file:///home/user/public_html/repo/myrepo/trunk -m "trunk created"
After doing this, why can't see my trunk directory in /home/user/public_html/repo/myrepo? When I run the command svn ls -R file:///home/user/public_html/repo/myrepo/, I can see it.
I need to see the trunk directory because I want to create a symlink to work on the app online:
ln -s /home/user/public_html/repo/myrepo/trunk /home/user/public_html/dev/
How can I make the trunk folder visible?
The repository directory created with svnadmin create is essentially a database where Subversion stores information about files and their versions.
To access the files contained within the repository, you need to check out a working copy using the svn checkout command. For example, the following command will check out the repository you created to a directory named /home/user/public_html/working:
svn checkout file:///home/user/public_html/repo/myrepo /home/user/public_html/working
After checking out the repository, the /home/user/public_html/working directory would contain trunk, branches and tags subdirectories and you could then create a symlink:
ln -s /home/user/public_html/working/trunk /home/user/public_html/dev/
For further information, I'd recommend reading the Version Control with Subversion book (in particular the Fundamental Concepts and Basic Usage chapters).

"git add" returning "fatal: outside repository" error

I'm just entering into the wonderful world of git.
I have to submit a bunch of changes that I've made on my program, located in a directory called /var/www/myapp.
I created a new directory /home/mylogin/gitclone. From this directory, I did a git clone against the public repo and I was able to get the latest copy created.
I'm now trying to figure out how to take all the files in my working folder (/var/www/myapp) and "check them in" to the master repository.
From /home/mylogin/gitclone, I tried git add /var/www/myapp but I'm getting an error that the folder I tried to add is outside the repository.
Can you give me a few pointers on what I'm doing wrong? Also, I'd like to add everything, whether it's different from the master or not.
Thanks.
First in the clone folder you can create a Branch (so the master stay untouched)
git branch [branch_name]
After, just copy the files you want from your old folder to the clone folder.
When you are done, just add / commit your change and Merge your branch into the "master" branch. It will look like to something like this:
git add .
git commit -m "Comments"
git checkout master
git merge [new_branch]
Try this tutorial from GitHub.
You'll have to move all the files from /var/www/myapp to /home/mylogin/gitclone and then do a git add . and then git commit -m "Your message".
When upgraded to git version 2.12.2 that error appeared, I nooted the i add the file with a full path like:
git add c:\develop\project\file.text
when removed the full path it start working, like:
git add file.text
To add some files or folder to your repository, they have to be in the folder you created with git clone. So copy/paste your application in your local git folder and then go in it and do git add * and then you'll be able to commit to the server with git commit -m 'message' and finally push the changes to the server with git push
Okay, this error came up for me because I moved the project from one computer to another.
So the git was not able to figure my global git user.name and user.email
I opened the command prompt and specified my old git user.name and user.email from previous computer. Kindly run the following commands and it should be fixed.
cd pathToMyProjectDirectory
git config user.name "myName"
git config user.email "myEmail"
That's because you are versioning stuff inside /home/mylogin/gitclone and git tracks everything inside that folder. You cannot track other folders outside of this repository.
A solution might be create a submodule, or using a symbolic link using ln -s
Git only tracks files and folders within the root folder which includes the .git directory and the subfolders inside root folder. The folder you are trying to add is outside the scope of git.
What would you actually like to do is first git checkout -b myapp which will create and checkout a new branch based on the master branch of the repository you cloned. Then you would actually copy all your files over and commit them with git commit -a -m "Short descriptive name about what you did". The parameter -a you passed to git commit is for including all the changes done to the repository and -m is to include the commit message in the actual command. After that you can either push back to the main repository if you have write access to it or push it to your own public repo or don't push it at all.
What I've described above is pretty much the basics of git. Try reading this book which is pretty descriptive.
Maybe someone comes along having the same trouble like I had:
In my case this error was thrown while using husky (commit hooks) https://github.com/typicode/husky
It was just an error because of encodings. My source was located in a directory that contains a special character ("รถ")
Seems like husky uses "git add" with the absolute path of the source which fails somehow at this point
I renamed the path and it worked fine.
This message can also appear when the file name is listed in the .gitignore file.
My scenario is that the git repository's path has symbolic link and git throw out this error when add file say to "/home/abc/GIT_REPO/my_dir/my_file".
and "/home" is actually a softlink to "/devhome".
code ninja gave me some light when I tried to debug this case.
So I tried get the target directory by using the command readlink -f /home/abc/GIT_REPO before run add command.
And then everything works like a charm !
I encountered the issue at Windows box with maven-release-plugin.
The plugin tries to add files using absolute path and I have noticed that the path in the Git add command starts with uppercase D: while the path in Working directory: log line started with lowercase d:
I have added core.ignorecase = true to the Git settings and the issue was gone.

need a shell script to do svn update,svn delete and svn import

i have created a local repository(svn) on my server.
we do svn update on the repository to fetch the recent drivers(code).The files recieved are in the below form.
goto code base and do svn update
create a url to this code base and take the files into a log so as to print dynamic messages when you do an svn delete and svn import saying that particular file/files have been imported/deleted.
third step is to delete a few files from the repository. svn delete.
svn import
svn import . file:///home/head/input/exrep/ -m "sync operation from abcrepos" > $file`;
svn del file:///opt/svn/trunk/input/hyrep/exrep/www/js/nvm/nvmgraph.js -m "removing javascript"
need a shell script to do the following automatically
problem-into my local repository i always need to do svn import and delete. when new additions are made into the original repo it says "file existing" and will not replace the file with new contents.so script to do above steps to automate the svn update,svn delete and svn import.
You will want to use a "Vendor Branch" instead (see the documentation). There are scripts and tools to support you mentioned in the docs.

SVN - How to upload a single file?

How do I upload a single file from my local computer to a SVN repository?
I can import a directory, but I can't import a single file into existing directory.
I use SVN in linux (command line).
Any help would be appreciated.
Edit:
I forgot to mention, I need to upload this file into a specific directory that has nothing to do with directory structure in my local computer (say I upload from Desktop).
So I want to upload a file from Desktop to https://.../somefolder
This can be done as the OP requires.
svn import -m "Adding a new file" file_to_upload.ext http://example.org/path/to/repo/file_to_upload.ext
This allows uploading a file directly into the repository without checking out to a local working directory.
Well, short answer is that it doesn't work like that :)
In SVN you work with a checked-out revision of your repository. In order to "upload a single file" you have to "add" the file with "svn add foo.txt" and then run "svn commit -m "Added file foo" foo.txt". But you can only do this to an existing repository. Therefore you must first checkout the revision (rev of trunk or a given branch) of the repository to add the file to. So the entire steps would be something like
svn co https://svn.internal.foo.com/svn/mycoolgame/branches/1.81
create your new file in the correct place in the folder structure checked out.
svn add your new file
svn ci -m "added file lalalalala" you new file
After this, you can delete your local copy again.
8-year edit: As mentioned svn import can also be used to accomplish this without having a local copy under version control. Do note though that this does so recursively and will add directories not present in the repository. This could be desired behavior or a source of potential errors depending on the situation.
svn add /path/to/your/file.txt
svn ci /path/to/your/file.txt -m "This is where the message goes"
Or if you havn't added anything else just commit with
svn ci -m "Your message"
svn add filename
svn commit filename

Resources