I'm a beginner to using github and I accidentally added this folder to my github but I cannot find a way to remove this please help.
I tried deleting this folder from my main folder and redoing my git pull and push and in the terminal it said that this file as already been removed. But once I pushed my file again the files that needed to be updated were updated but the folder is still on my github repo.
Try:
git rm -r <folder>
git commit -m "remove folder"
git push
The changes will only be saved when you run the commit command
Related
I added a directory with files to the local git repo and did the commit. When it was pushed to github it looked like it was added. When I do a clone from github the directory does not show up. I do not find a .gitignore file. Doing a check-ignore --verbose to one of the files added does not return anything.
For an experiment (with the clone up-to-date) I added a directory "gittest" with a file "hello.txt"; did the commit & push. The push appears to show the addition. A pull in the clone appears to show the addition, but the directory/file does not show. Other than starting a new repo and deleting the old one I am stuck as what to do next.
I have a repository. I pushed files from a folder. Now I don't want to create new Repository. But I want to push files from a new Folder. The folders are almost same. How can I do this with command?
Assuming that you already have the repository created, you can do the following.
cd newfolder
git clone <link-to-clone-from>
Then copy the files to new folder. Check git status -s to see a summary of changed files in new folder after you copy files. Using git diff or beyondcompare can show you the exact changes that you are about to commit next. If everything looks fine, continue with the next steps
git add -a
git commit -m "your commit message"
git push origin master
Assuming you have two folders:
- Old repo folder
- .git
- My old folders
- My old files.
- New repo folder
- My new folders
- My new files.
And you want to replace all stuff in the remote repo from the old repo folder with the new repo folder.
To do that:
First, delete all content except the folder: .git in the Old repo folder.
Then, copy everything except the folder: .git from the New repo folder to the Old repo folder
And run commands in the Old repo folder:
$ git status
To get if everything is fine. Git will detect that you have replaced a lot of files and deleted many of them. Check the output.
$ git add . && git commit -m "Replace with new content"
$ git push
And this will save your changes and send it to remote server.
Sadly I've been at it for 3 hours trying to commit my assignment which is a single folder... This is my private github repo
I can't drag the folder since it's limited at 100 files apparently there's like 4000 in my folder?
What I've done is:
$ git clone githuburl
(i now dragged my assignment folder to this repo in my own pc)
$ git add assignmentfolder (pages)
$ git commit -m "first commit"
$ git push origin master
And as you can see it straight up ignored every single file and just committed the folder name?
I think the proper way to do this is:
git clone githuburl
cd githubfoldername
then move all your files there
add a .gitignore file there and exclude node_modules and everything else that has to do with caching and external packages because you don't need them in your repo. Everyone who is going to use your code will be able to install the packages as you did. Just make sure you include the:
packages.json if you used npm
or yarn.lock if you used yarn
Then you can safely
git add --all
git commit -m "your message"
This way you will avoid adding useless files to your repo as #Dmitri Sandler said and you will be able to push everything easily
Generally you should think about files not folders. Try to use wildcard in the path:
git add <folder>/*
It is a good idea to use git status to see what files were staged for commit prior to committing them.
In Github, i have already a repository, e.g. called "java8"
And under it, i would like to have a sub-folder, e.g. called "01-lambda"
So my folder structure in github should be
java8
01-lambda
02-enums
etc.
Then I want to commit my code to the sub-folder "01-lambda"
How can I do that?
What I tried:
I just created a new folder with a txt file "01-lambda" under the repository "java8", then I tried to commit, but git bash shows they cannot find the sub-file.
I just commit my code directly to repository "java8", but then I need to change path of every files, and add /01-lambda in the path
git init
git add *
git commit -m “my first repo”
git remote add github .git
git remote -v
git push -f github master
I just created a new folder with a txt file "01-lambda" under the repository "java8", then i tried to commit, but git bash shows they cannot find the sub-file.
You need to add before committing, assuming you do have a file inside the new folder (Git would not add just a folder):
git add 01-lambda
git commit -m "add 01-lambda"
Why can I not open my folder in GitHub? It has already been asked but i could not find the right solution for me. Here is the link for the same problem: Why can I not open my folder in GitHub?. Can anyone help me to get rid of it. Thanks in advance
That is because ngApp is itself a git repo (that folder included a .git subfolder in it)
So when you git add . in your repo, it just recorded ngApp as a gitlink (a SHA1 reference to the repo) without any URL (as opposed to a submodule, where a .gitmodules would include the url of the remote repo).
When you clone your repo back, that is all you get: a reference without URL.
If karanpepi/mean-stack-crud is supposed to include ngApp folder, go back to your local repo (where you have the ngApp folder) and delete the .git
cd /path/to/local/repo
git rm ngApp
git commit -m "remove gitlink"
rm -Rf ngApp/.git
git add ngApp
git commit -m "Add ngApp content"
git push