Cloning github repositories to pc and making them executable on linux - linux

Hay guys I have a problem I tried to clone a repo from git by git clone after download I tried to run the command, although the command was not foud. So after adding the file to the path by export PATH = "..." the command did not work how can I fix this?

To specify the location of executables, you must specify the PATH as set of colon ":" separated directories.
Here's a reasonable template for you to follow:
export PATH=$PATH:<add-your-new-dir-here>
Typically, the PATH is always exported, so you'll only need to do this:
PATH=$PATH:<add-your-new-dir-here>
In your question, you indicated that you are adding a "file" to the PATH. Remember, you must add directories.

Related

mlflow run git-uri clone to specific directory

I am using mlflow run with a GitHub uri.
When I run using the below command
mlflow run <git-uri>
The command sets up a conda environment and then clones the Git repo into a temp directory, But I need it setup in a specific directory
I checked the entire document, but I can't find it. Is there no such option to do so in one shot?
For non-local URIs, MLflow uses the Python's tempfile.mkdtemp function (source code), that creates the temporary directory. You may have some control over it by setting the TMPDIR environment variable as described in Python docs (it lists TMP & TEMP as well, but they didn't work for me on MacOS) - but it will set only "base path" for temporary directories and files, the directory/file names are still will be random.

Copying shell file to path

I'm new to WSL and Linux, but I'm trying to follow installation instructions for rhasspy (https://rhasspy.readthedocs.io/en/latest/installation/#windows-subsystem-for-linux-wsl). I have run the make install command successfully and the next step says I should copy rhasspy somewhere in my path but I can't quite figure out what copying to path means.
When installation is finished, copy rhasspy.sh somewhere in your PATH and rename it to rhasspy.
I added it to path but nothing changed so I was wondering if there is something I'm doing wrong. Right now when I run rhasspy on wsl it says rhasspy.sh: command not found. Any help would be really appreciated!
What it says is, put it in some place where the system will look for it when you type its name without full path in the shell.
There is an environment variable PATH that contains all those locations, separated by a :. (Check out echo $PATH.)
So, the author of these instructions leaves it up to you whether...
You want to copy the file to a location of your choice that is already in the PATH, such as /usr/local/bin or ~/bin.
Usually ~/bin is a good choice because it is per-user and doesn't pollute the system.
(Note that the directory ~/bin is added to the PATH by your .profile file only if it exists, so if you don't have this directory yet and create it now, you need to start a new login shell or run . ~/.profile1 before you can use it.)
- OR -
You want to create a new directory specifically for this application (say for example ~/opt/rhasspy) and append that directory to the PATH variable.
This can be done by adding the line export PATH=$PATH:~/opt/rhasspy to your ~/.profile file. Then, start a new login shell or reload the file using . ~/.profile1 for the changes to take effect.
If the directory in which this file is currently located is OK for you to keep permanently, then you can also just add that directory to the PATH instead of creating a new one.
Note: The PATH always contains directory paths in which the shell will look for executable files. It does not contain the actual file paths!
1: Yes, technically it is "cleaner" to log into a new shell or to run that one export statement manually instead of using . ~/.profile because the latter will apply things a second time that were already done before, so for example it can end up with the same directory in the PATH multiple times in the current session. In most cases that is fine though.
PATH is an environment variable. When you launch env, you see the list of known environment variables on your system.
In order to add something to your PATH variable, you need to take the variable, add the mentioned directory (preceeded by a semi-colon, most probably, as a separator) and store this again as the PATH variable. This can be done as follows (own example):
export PATH=$PATH:/home/this_user
the "PATH" it is referring to in linux is just inside the folder called /usr/bin. when you type a command into the terminal it looks for a program with that name inside the location. im not sure if this is the PATH you are looking for but hope it helps

How to make current directory a git working directory

I've written multiple *.cpp files in the location ~/Code/CPLUS before I know the existence of git.
Now I want to use git for version control.
I created a folder ~/git_repo/, and in this folder, I ran git init command. When I tried to run the command git add my_first_c.cpp under the path ~/Code/CPLUS, the following message appeared:
fatal: Not a git repository (or any of the parent directories): .git
Then I typed git init ~/git_repo/ under the path ~/Code/CPLUS, the same error still appeared when git status was typed.
If I type git init under the path ~/Code/CPLUS, the add and commit can be executed. The only problem is that .git is stored in ~/Code/CPLUS/, while I'd like it be stored in ~/git_repo.
My question is how to make the folder ~/Code/CPLUS a working directory while the repo info is stored in ~/git_repo/? And my machine has no GUI.
You could try exporting the variables export GIT_WORK_TREE=~/git_repo/ and export GIT_DIR=../Code/CPLUS from terminal (or in your ~/.bashrc) so Git uses these.
Thanks #Alariva , the suggested solution indeed solved this question. With .git created in ~/git_repo/, typing git --git-dir=/abs/path/to/repo/git_repo/.git add my_first_c.cpp works.
The solution comes from this post.

How to change repositories location in gitolite3

I've just installed gitolite3 and as a default it creates its "home" /var/lib/gitolite3
I want that folder to be somewhere else like /home/gitolite3.
How do I move it there?
All the references I found around the web turn around a REPO_BASE variable that is nowhere to be found.
Any ideas?
GL_REPO_BASE is a variable you can set in your ~/.gitolite.rc file.
By default, it references $HOME/repositories.
But this isn't related to where you have installed gitolite.
You can install it wherever you want:
git clone git://github.com/sitaramc/gitolite
gitolite/install -ln /path/to/wherever/you/want
gitolite setup -pk yourname.pub
The OP added in the comments below:
I added this line to the .rc :
GL_REPO_BASE => "/home/gitolite",
(mind the trailing ',')
Use this command line to reconfigure Gitolite3:
dpkg-reconfigure gitolite3
In the second question the system ask you for repository place. There you cant set any location where you want to have gitolite3 repositories files.

Simple command to add directory and all files under into svn

Is there a simple command to add a directory and all files underneath it to svn?
I have tried svn add directory which makes sense to me but this doesn’t work as expected. I have googled it and there are solutions which all appear a bit long-winded for something so simple.
What would be the standard way of doing this?
svn add directory only works if the directory hasn't been added already. Adding all new files is not standard operation in svn world. Git does this but that's sidetracking.
You can often get by with svn add directory/* but it misses new files in existing subdirectory. So:
directory/newDirectory/file -> is added
directory/oldDirectory/file -> is NOT added
If you really need to add any file anywhere in the directory hierarchy this one liner will set-up an alias for you to do this:
alias svn_addall="svn st|grep ^?|sed 's/./svn add/'|sh"
Put it into your .profile and you'll have easy access to it any time. :-)
Funny. Which version of svn are you using. I`m on a mac and use svn 1.6. And it works for me.
When i look at my man pages for svn then it looks like the command is recursive by default. You can permit the behaviour with:
--depth ARG : limit operation by depth ARG ('empty', 'files',
'immediates', or 'infinity')
svn add folder will add the folder and its contents. How doesn't it work as you expect?

Resources