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

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

Related

Github: Clone succeeded, but checkout failed (Problem with file name)

I am trying to clone a repository, but I run into the error mentioned below.
https://github.com/Sefaria/Sefaria-Export/issues/20
I am using the Ubuntu terminal and receive the same error.
Unfortunately, the issue is not being addressed.
Can someone suggest a way to bypass the error (or even skip the faulty file altogether) so I can make a clone of the repo?
Thank you!

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.

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

TFS with mac os

I have to use TFS for my Mac machine for iPhone app development. So that I have used the following step as from the Git-TF_GettingStarted.html
Extract the contents of Git-TF-Release-Preview.zip to a folder on your local machine,
i.e. C:\git-tf on Windows, or /user/git-tf on Mac/Linux. for installation.
But while giving the command "git tf clone http://myserver:8080/tfs $/TeamProjectA/Main "
an error is coming as
git: 'tf' is not a git command.
Then I have removed the tf from the command, at that time it get worked and asked the username and password, but authentication get failed.
How can I resolve this issue?, if anybody has idea then please help me.
You haven't actually set your PATH variable, which is why you're getting the command not found problem.
If you've set your path, using, as an example: PATH=$PATH:$HOME/git-tf-2.0.2.20130214, then the git command will allow the sub-command tf, which should work like the documentation suggests, as in:
git tf clone …
will work once you've set the PATH variable, otherwise you'll have to reference the git-tf command directly.
The command that is extracted is git-tf, and git is smart enough to look for the git-tf command if you have set the PATH and try to use the operation git tf.
You better go with TFS Everywhere http://www.microsoft.com/en-us/download/details.aspx?id=4240
And use Eclipse like a client for your development in XCode.

Github windows: Commit failed: Failed to create a new commit

I have: http://windows.github.com/
My current project has around 20k files, around 150MB (and not speaking about how slow it is and I cannot do a thing now) it doesn't even let me commit! I get this error: Commit failed: Failed to create a new commit.
That seems that nobody is having.
I've already deleted the folder and cloned again, no escape. What to do?
If I choose to open shell, all this *** crashes!
Edit:
Since the problem I've switched to Git Extensions and I didn't look back!
thanks for your answers
This happened to me. Try opening up PowerShell and manually committing each file using the "git add [file name]" command. To see which files have been added, enter "git status" into the command line. The green files have been added, the red ones have not been added.
Once you've added them all, type "git commit." Then go back to Github for Windows and sync it up.
I'm not sure what causes this issue, but once I followed the above steps, Github went back to its normal, awesome behavior.
I had this problem too after an unexpected crash. I couldn't fix using the 'Open Shell' option as suggested. I had to open the Windows CLI (Start -> run -> cmd) and delete the index.lock file in my GitHub folder:
cd \Users\myUser\my\local\github\repo
cd .git
del index.lock
Then when I went back to the GitHub app, it committed successfully.
Note that for some people, according to comments, the file to delete doesn't have the .lock extension, so the delete command could also be del index.
Im using Githug for Windows (7) and faced the same problem. While using PowerShell I realized that I didn't fill Full Name and email address in tools > options. Look like a beginner mistake (and I am!).
hope it helps!
just try to commit a few from your updates. 5 for example. and then make another commit with all other updates.
I am using windows client and getting the same error. Then suddenly I realized that my local db in app_data was opened on the SQL management. It just simply can't commit the some files to github if they are opened or using at the other programs.
Just disconnected management studio closed it and just simply committed.
This may be your case also. Check your files out!
So guys this is the full steps I had to take in order to fix the problem...
1) Using Process Explorer (you can download it form here http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) I searched for any process referencing ".git\index" and then I killed it.
2)Then using Git Shell (Windows Power Shell) I went into the repository which was giving me such difficulty and then furthermore went into its .git folder. (cd .\your_respository_name\.git). I then removed the index.lock file in that directory (rm -r index.lock).
3)Then from within that same directory I ran git reset HEAD.
4)Then I manually committed each file using the "git add [file_name]" comand. (You can check that they were added successfully if when you run git status, the files are green.
5)Next run git commit if your files are added correctly.
6)Finally go back to github for windows and sync everything up and it should hopefully work and resolve the problem.
This issue seems to be a bug in the github client - I get it "all the time" on the machine on which i only installed the github client.
I Never saw it on the git + github PC (I have not used it for a few days now).
Doing the "git add ." and then "git commit" worked for me also on the shell - but that is the thing the GUI should be doing not me - otherwise I can just stick to the git shell client.
Had the same problem, couldn't commit or sync using the windows GUI, but I could commit the changes through the shell. Once I'd added the changes through the shell the windows GUI started to sync normally. Hopefully it's a one off.
I had an interesting issue - even though I had an excel file open called "Combined - ForImportv4.xlsm", Git UI had no problem checking that in but it gave the error in the OP's subject for the backup file "~$Combined - ForImportv4.xlsm" so I discarded that change and all went through.
PS: As for why i'm checking an Excel file into Git ... just don't got there :)...
I had this issue with the git windows desktop commit tool. I was getting this often and I figured out that Visual Studios was locking the files. To get around this issue I simply closed visual studio and the commit / sync worked fine.
I googled failed to create repository and ended up here.
My problem was that the description for my new repo was too long. There is a charlimit for the description, but GitHub tried to push it anyway and failed.
I just had the same problem, tried some of the suggestions on this post but none worked so what i did was, on the GiTHub client i went to tools -> settings and then click on the section where it says add/create default ignored files. Then hit Update and try to commit again through the client.
It happend to me when my project was opened in an IDE (Netbeans in my case), make sure non of the files you're about to commit isn't open in some program.
I checked the log file at C:\Users{user}\AppData\Local\GitHub\TheLog.txt and found this error:
LibGit2Sharp.LibGit2SharpException:
Could not open 'SomePath\SomeProject.opensdf':
The process cannot access the file because it is being used by another process.
I closed Visual Studio and the commit was then created successfully.
n.b. I removed actual file path in the above error.
If you are new user make sure that you have confirmed your e-mail. Had same problem and confirmation fixed it!
You can manually navigate to index.lock which is found inside the hidden .git folder of your repository location. Once you delete index.lock you will be able to commit as per usual.
The easiest way to navigate to the folder will be to click on the folder breadcrumbs inside windows explorer and add \.git and press enter.
Just delete 'index.lock' in the '/.git/' directory. Solved the problem for me instantly.
I had this happen to me and this is the easiest way to fix it:
Make a copy of your local folder that has the repo and remove the .git folder form it.
Delete the original repo folder with files.
Re-clone the repo from GitHub with the Windows client.
Delete all of the files that get cloned except for the .git folder.
Copy all files from the copied folder into the new clone folder.
Add in your commit notes and the commit should work this time.
I had the same problem and I fixed it by renaming one of the file because its name was too long. This fixed the problem.
Here is error message from git shell:
fatal: unable to stat 'plugins/com.napolitano.cordova.plugin.intent/example/app/platforms/android/CordovaLib/build/intermediates/classes/debug/org/apache/cordova/NativeToJsMessageQueue$OnlineEventsBridgeMode$OnlineEventsBridgeModeDelegate.class': Filename too long
I REBOOTED my Windows 7 machine and tried again - IT WORKED!
I had the "Commit failed: Failed to create a new commit" and tried to delete the index or index.lock file via windows command prompt and that didn't work. I deleted it via windows explorer, that didn't work.
I tried to check credentials like another reply in this list said, but couldn't figure it out and the credentials seemed 'ok.' So - I rebooted. Viola.
I'm not sure this will help anyone, I'm not all that great w/ this stuff, but trying.
I deleted ".git" in children directory and the problem was resolved.
It happened to me once ,I had a empty repository inside of the repository that I cloned.
It was a silly mistake though but could happen .