Basic Github Repo Creation - github

I just created my first Github Repo through the Github Bash on Windows 10.
I ran:
$ mkdir Projects
$ mkdir Projects/DataScientistsToolbox
$ mkdir Projects/DataScientistsToolbox/sample
$ cd Projects/DataScientistsToolbox/sample
$ git init
Initialised empty Git repository in /home/osboxes/Projects/DataScientistsToolbox/sample/.git/
$ ls -la
I am really struggling with understanding this code. So I created three directories: projects, datascientiststoolbox, and sample.
What does the cd command on my code do?
Does the git init code run the creation?
What does the ls -la do?
Lastly, I can't seem to find where the repo is saved on my computer, is it located on the desktop or in a special spot?
Thank you, sorry about the large amount of questions.

The cd command lets you change your working directory.
Yes, git init creates (initalizes) a new repository on your machine in your current working directory.
ls displays all files and directories in the current working directory. -la changes the way they are printed.
pwd makes your machine print the working directory. Use it to find out where your repository was created.
Read here about how to create a GitHub Repository. And this is a list of basic unix commands - it may help you to get started with unix systems.

You created only one repository with git init. cd stands for change directory, it's like when you double-click a folder to open it.
So basically your repo is in Projects/DataScientistsToolbox/sample.
ls is used for listing all files in the current directory you're in. -la are flags for different styles of displaying (try running just ls).
Also, all these commands have nothing to do with GitHub. They're a part of git.

Related

How to skip big files for GitHub in Machine Learning Repo?

I'm new to GitHub and Machine Learning.
I've been using Conda and Jupyter Notebook for my tests in ML.
It all was fine.
But I know that it's better to use VS Code (easer to code?) and GitHub(promote and share my code?). I don't really care about version control because I'm only doing my own fist steps.
But nevertheless I did create GitHub account and I try to create a Repo and push my already existing folders with Python files. These folders also contain raw and modified data that is used in the code... .csv and .xlsx files. Some of them are 100 Mb+
I use Mac M1 and I've tried to create .gitignore_global file (and it works - when I git add . from the Terminal files noted .gitignore_global don't push (upload).
I've also created a .gitignore file in my working directory.
And I use find ./* -size +100M | cat >> .gitignore to add these files in the .gitignore (and it adds).
But when I try to git init -b main , git add . , git commit -m "First commit", git remote add origin <REMOTE_URL> and git push -u origin main it still tries to upload 100m+ files.
I've tried to delete the whole git subfolder and Repo on the site... it doesn't work.
What should I do in order not to upload (push) these files?
How do you use GitHub for DataScience / Machine Learning with these limitations?
It's really impossible not to use all the data files...
Please see above. I've tried several ways

Specify alternate project-level README.md on GitHub

Using GitHub's web-based interface I cannot figure out how to specify an alternate path / filename for the project's README file.
When creating a new README, the web interface does give me the option of using any arbitrary path or filename I want, but the file I select is not used as the project-level README. I would like it to be displayed when users visit the project page.
In the context of projects that are modules or extensions (e.g. Magento 1 modules) having all such README files at /README.md for all such projects would make them all get over-written in the final merge, so an alternate path or filename should be used (e.g. /docs/projectname/README.md or /projectname.md).
How can I do this in a way that specifies that file as the default README?
GitHub looks for README files in a few places:
If you put your README file in your repository's root, docs, or hidden .github directory, GitHub will recognize and automatically surface your README to repository visitors.
If you want to use another file for your project-level README I suggest creating a hidden .github/ directory and symlinking your file there with a name GitHub expects.
On Linux or macOS this should be fairly straightforward:
# From your repository root
mkdir .github
cd .github
ln -s ../docs/projectname/some-README.md README.md
On Windows things are a bit trickier.
Symbolic links are only available on NTFS filesystems on Windows Vista or later, and creating them requires special rights or Developer Mode. They are not supported by Git on Windows out of the box.
In your Git shell, in the root directory of your repository, enable symlinks for the current repo:
git config core.symlinks true
Now run cmd.exe as administrator¹ and cd to the repository root. Make your symlink:
mkdir .github
cd .github
mklink README.md ..\docs\projectname\some-README.md
Note that the name of the link goes before the name of the real file here, in contrast with the Linux and macOS instructions above. You can close cmd.exe now and go back to Git Bash.
Now commit .github/README.md and push to GitHub. You'll probably want to make sure that there isn't a real README file in any of the other locations GitHub uses (the repository root or a docs/ folder in the repository root).
Windows users who clone the repository won't get a symlink automatically. If they wish to have that behaviour they should clone with a special argument:
git clone -c core.symlinks=true <repo-url>
¹It's possible to grant mklink permissions to non-admin users, but running as administrator is likely the simplest solution.

Move All Dotfiles Out of Root Directory

I'm am running macOS Sierra, and am in the process of moving all dotfiles into one directory. I have successfully exported many environment variables for various installations (vagrant, composer, oh-my-zsh etc) that allow me to install to a sub-directory of my choice.
Unfortunately, programs like npm, subversion, homestead, git, and others do not offer such configurations.
I use a dotfiles repository, where I keep my configuration files under git. The idea is not new. What I did is move them to another directory and them create a symlink to them in the home directory. It does not clean the home directory as you wanted, since it's the standard place for configuration files, as stated by Norman Gray, but at least you can version them and share them across machines.
Example:
cd ~
mkdir dotfiles
mv .gitconfig dotfiles/.gitconfig
ln -s ~/dotfiles/.gitconfig ~/.gitconfig
Check out stow. That's what I use.
I have a ~/dotfiles/ directory which has folders in it like vim/ X/, etc.
Now for example vim/ will have a .vimrc file in it, and from ~/dotfiles I can run stow vim/ and it will automatically manage the symlinks to the home directory.
I can also run
cd ~/dotfiles
for folder in ./
do [[ -d $folder ]] && stow -R $folder
done
To update all my dotfiles (the -R deletes old symlinks that don't exist anymore)
There is a good introduction here: http://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to-manage-your-dotfiles.html

fatal: could not create work tree dir 'kivy'

I'm trying to clone my fork of the kivy git, but it's not working. I've made the fork correctly, I believe, but when I type this into my Mac terminal:
git clone https://github.com/mygitusername/kivy.git
I get this error:
fatal: could not create work tree dir 'kivy.: Permission denied
Anyone see what I am doing wrong? Thanks!
You should do the command in a directory where you have write permission. So:
cd ~/
mkdir code
cd code
git clone https://github.com/kivy/kivy
For example.
Your current directory does not has the write/create permission to create kivy directory, thats why occuring this problem.
Your current directory give 777 rights and try it.
sudo chmod 777 DIR_NAME
cd DIR_NAME
git clone https://github.com/mygitusername/kivy.git
In my case what happened was that the user I was using had no ownership over the directory. I simply had to change ownership of the directory to that user.
For example if user is ubuntu:
chown ubuntu:ubuntu -R directory-in-question
cd directory-in-question/
git clone <git repo comes here >
If you are working in Windows you have to change the permissions of the directory putting full permissions or just write to let github clone the repository. The steps are:
Go To your directory
open properties
go to tab "security"
change the permissions
apply
Assuming that you are using Windows, run the application as Admin.
For that, you have at least two options:
• Open the file location, right click and select "Run as Administrator".
• Using Windows Start menu, search for "Git Bash", and you will find the following:
Then, just press "Run as Administrator".
For other Beginners (like myself) If you are on windows running git as admin also solves the problem.
I had the same error on Debian and all I had to do was:
sudo su
and then run the command again and it worked.
Here is how to change ownership of a directory or a file if you are on WSL2 Ubuntu. You have to set both the user and the group. Here is the command:
sudo chown -R your_username:root path/to/dir
-R is for recursive, which changes the ownership of everything inside path/to/dir. Don't change the group name from root. It should stay your_username:root
The directory in which you are trying to write the file or taking the clone of git repository, it does not has the write permission. That's why this problem is occurring.
Please change the write permission of directory.
Then clone the repository.
If you are working on a mac, then this is probably because you don't have permission to write to the directory.
When I had this issue, I followed the following steps:
Opened the folder in finder -> right-click -> get info -> click on the lock on the bottom right of the pop up window, enter admin password -> then change the Sharing and Permissions to Read and Write for wheel, and everyone -> click lock again to save
This does happened also when you are cloning a repo without selecting any working directory. just make sure you did cd into your working directory and i believe it will work just fine.
You need to ensure you are in a directory in which you have write permission.
This might not be the directory in which Git is in once you open the terminal.
In my case (Widows 10)
I had to use the cd command
to change the directory to the root directory (C:)
After that it worked just fine.
Cloning software into a directory using elevated privileges ie root or sudo is considered a security risk.
You can check to ensure you are in a directory in which you have write permission.(non system) this is probably the directory in which Git is being called from and git is just being decent here by complaining ;-)
Try the following steps for a quick painless solution :-)
1.open the terminal;
2.cd /<desired directory>
3.git clone <git-repo>
This does happened also when you are cloning a repo to your local machine without selecting any working directory. just make sure you did cd into your working directory.
For me it was turning off Realtime Protection on the Virus and Threat Protection on Windows.
All you need to do is Run your terminal as Administrator.
in my case, that's how I solve my problem.
sudo chmod 777 DIR_NAME
cd DIR_NAME
git clone https://github.com/mygitusername/kivy.git
should work fine

How to deploy jekyll on slicehost

I have jekyll blog up and running locally. I am not sure how to push the content to slicehost. They have an instruction page but I am not able to follow the instruction.
I have all my content on github. Just need to know how to make post-update hook work?
To deploy a generated Jekyll site, you just need to copy the contents of the local _site directory to the appropriate remote directory on your server (often public_html, but it depends on the server configuration).
Personally, I think the easiest way is to just use rsync, assuming you can use rsync with your server. Then it's as simple as executing the command
$ rsync -avz --delete _site/ user#host:/path/to/web/root
to deploy your site. For my Jekyll-based sites, I encapsulate this in a Rake task so I can just do
$ rake site:deploy
to copy the site to the server.
If you can't use rsync, you can always transfer the _site directory via FTP, which is also pretty easy to do (and with a bit of Ruby scripting, can be automated using Rake as well).
You can use Git, as noted in the Jekyll docs. You will have to have Git installed on your server, and access to using it. If that's the case, you have to create a bare Git repo on your server. In the bare repo, you then create a post-update hook to check out the latest copy of the site. You do this by creating a script at $BARE_REPO/hooks/post-update with contents like the following (as noted here):
#!/bin/sh
unset GIT_DIR && cd /path/to/web/root && git pull
You then clone the bare repository to your web root, like so:
$ cd /path/to/web/root
$ cd ..
$ rm -rf root
$ git clone /path/to/bare/repo.git root
As you can see, it's often easier to use rsync or FTP instead of Git.