fatal: could not create work tree dir 'kivy' - github

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

Related

When I try cloning a repository from github i keep getting an error, anyone know what i'm doing wrong?

I'm trying to clone a repository on github into a directory on my computer.
I'm on mac and when i run this code
git clone <git#github.com:melenagrilliot/coding-prework-2023.git>
I'm getting an error sh: parse error near `\n'
Anyone know what I could be doing wrong ?
In the interest of covering all bases, I will assume you have already ran the command without the < >
git clone git#github.com:melenagrilliot/coding-prework-2023.git
If the above doesn't work, then it is not a git related issue. There is something wrong with your shell (sh). The issue might stem from the .profile file in your home directory. Can you please use the following command to copy the contents of your .profile file and share it here?
cat ~/.profile | pbcopy

how can dotfile executeable issue on codespace?

Good day!
when I enable Automatically install dotfiles in the GitHub codespace setting and follow create codespace, my dotfiles are not found, and the install script is not run!
my dotfile repo
When I see the log, codespace says install.sh script not executable!
how can fix this issue?
you must make this file executable with git...
git rm --cached install.sh
git add install.sh --chmod=+x
and next, commit and push to the repo!

Basic Github Repo Creation

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.

I got this strange error when delete files in xcode

When I try to delete things from my xCode project I get this strange error does not know why. It's seems like git error but I have not created git repository in my project.
This is the error:
fatal: Unable to create '/Users/dilipmanek/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
Plz help me solve this problem..
Exit XCode, go to a command prompt and type rm /Users/dilipmanek/.git/index.lock. Apparently you have a git repo of your entire home directory whether you meant to or not :)
If the git repository is there by mistake, you can go to a command prompt and type;
(always be careful with rm -r, it will remove all files under the directory given, so don't do it to your entire home directory for example)
rm -r /Users/dilipmanek/.git
...and remove the entire git repository. It will not affect any files that aren't placed in that directory, but make sure you've not copied anything you need to keep there.
The reason XCode won't delete the file is that when it finds a git repo, it will attempt to use it. Git locks files by creating a temporary file in the git directory, and if XCode crashes while doing any file operation, the file is left there and the next instance of XCode will think the repository is locked.

Eclipse Egit Failed to commit

I got Eclipse for PHP developers 3.0.2 With Egit 2.2.0 installed, and I am on windows 7
I got my project and repository set up and linked.
Yet i cant commit changes. this is the error i get:
Exception caught during execution of add command
Exception caught during execution of add command
I got Git for windows installed and set that in the Git configuration.
I also got my HOME variable set up with %USERPROFILE%
Also my project location is on a remote server that i mapped to Z:
This includes the git repo as well.
That remote location has Lubuntu 12.10 installed.
It has git installed as well.
I found what was the problem.
Git locked it self witha file in the ./git/index.lock
After i removed that everything worked fine.
Thanks to #NaGeL182.. I got it working now because Git locked
So I need to delete the .git/index.lock file
On Mac just Hit below command On Terminal
rm -f ./.git/index.lock
on Windows
del .git\index.lock
Hope this will help.
My 2 cents...
My git workspace is mapped locally on the dropbox folder (i'm a bit paranoid and prefers double backup options). Sometimes there's a mismatch with the sync process and dropbox keeps the git .lock file.
Since all i care about is my resources and not the git metadata - i've simply unchecked the .git folder from synching online.
give this a try, go to your repository and execute below command !
chmod -R 777 .git
I hit this issue on a Windows 11 machine. The fix was to remove the 'hidden' attribute from all files under the .git directory