I made changes on the folder called "client/" but they are not shown in GitHub Desktop, thus I can push it to my repository:
Inside there is a .gitignore file, and I have tried deleting it but even so the "client/" folder did not appear.
Here is the content in gitignore file.
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
How can I see changes in client/?
First, you can check if any .gitignore rule applies to your change (therefore ignoring said change) with:
git check-ignore -v -- client/my/changed/file
If it does return anything, any modification to that file would be ignored.
Second, check if client is a nested Git repository (meaning, with a client/.git subfolder): that would also explain why a change in that nested repository is not shown when GitHub Desktop display the parent repository.
The OP Henry mentions in the comments:
git check-ignore -v client/node_modules`
fatal: Pathspec 'client/node_modules' is in submodule 'client' , so did other folders
That means it is a git submodule which is declared in the parent repository, in the .gitmodules.
The client folder, therefore, is supposed to be empty on the GitHub parent repository: it is a gitlink, a special entry in the index, referencing the tree SHA of that submodule repository.
Related
I have recently pushed to github, and see a white arrow on one of my folders.
and when i click on the folder, it does not open it. On my local machine, it has contents, but in github i cannot access them. What does this mean?
Symptom
Check if locally you have a .git/ sub-folder under that folder.
Cause
That would mean the folder (locally) is a nested Git repository, whose tree SHA1 is recorded as a "gitlink" (gray folder with straight white arrow)
What you would then see on GitHub is that gitlink: SHA-1 of the object refers to a commit in another repository, represented by an empty folder name. It is a nested Git repository.
If you see a folder # xxx, then it is a submodule entry, meaning your own repository has a .gitmodules in it, which records, in addition of the gitlink, the actual URL of the remote repository.
It represents the object name of the commit that the super-project expects the nested submodule's working directory to be at.
In both cases (white arrow with a folder name, or white arrow with folder # xxx, folder name and version), it is a Gitlink represented a nested Git repository: a placeholder for another Git repository, hence an empty folder. But in the second case, that empty folder would be referenced/visible in a special .gitmodules file.
Solution (to remove the white arrow)
In order to restore that folder content:
submodule:
A git clone --recurse-submodules would restore the content of that submodule in your local repository (as opposed to a nested Git repo, where its URL is not recorded, and the content of the folder would remain empty)
The white arrow would remain on the remote repository, with folder # version displaying what SHA1 of the submodule repository is referenced by your project.
Nested Git repository:
Alternatively, you could, if you don't care about the history of that folder, delete locally its .git subfolder (assuming it is not a submodule, meaning it is not referenced in a .gitmodules file in your main repository), add, commit and push.
The white arrow would then disappear, and you would be able to access that folder content on GitHub.
Then you would need to delete the gitlink entry:
git rm --cache client_folder
# without a trailing slash:
# not client_folder/ but client_folder
Finally, you can add, commit and push that folder content.
The arrow may mean that is a submodule.
You could try:
git add yourfolder
If that results in an error like:
xxx submodule xxx
appears, you may try this:
git rm --cached yourfolder
Then, you could successfully run:
git add yourfolder
On your machine, if you navigated to the directory with the arrow and tried to view hidden files, you'd see a .git folder, indicating that it is a repository. This means that it is a repo contained inside the outer repo that you had pushed to GitHub.
The easiest way to get rid of the arrow and start seeing your files properly (in my opinion) is by deleting the .git folder. That way, it ceases to become a git repo and is a regular folder once more.
Now when you push to GitHub, you can normally access the folder and view all its contents.
If you want to remove a submodule from the git config files, Follow this, remember that if you DON'T want to delete the local directory of that submodule, DON'T do Step X:
Delete the relevant section from the .gitmodules file.
Stage the .gitmodules changes git add .gitmodules
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Run rm -rf .git/modules/path_to_submodule (no trailing slash).
Commit git commit -m "Removed submodule "
(Risky)Step X :- Delete the now untracked submodule files rm -rf path_to_submodule
In my case:
git rm --cached portal
ls
git status
git add --all
...
for me, the history of changes in the subfolders were no longer important
start by removing .git from the subfolder
git rm --cached myfolder
git add myfolder
git commit -m "making myfolder available"
git push
It's due to the .git file in some of your subfolders. If you cannot find it then follow these steps....
Click file option Click this image - 1
Go to Preferences , then click settings Click this image - 2
Look for text editor, then click files Scroll down to check .git in Exclude
section. Click this image - 3
If .git is present, then remove it.
Now you will find .git folder in your main or sub folder....delete it and upload the folder to GitHub.
THIS WORKED FOR ME !!
Go to your project folder.
Go to "View" from the nav bar, go to "Show" and check "Hidden Items".
Delete all the ".git" folders from your project.
Initialize new or existing repo again and push your code.
I have a problem with pushing to my remote repository.
What I did is:
1) I cloned an existing repository to my computer
2) I was working for a while at my computer with the project (adding some folders with new data, doing some changes to the existing files)
3)
a) I created my own remote repository on GitHub
b) used git remote set-url origin new.git.url/here
c) used: git add . then git commit -m "Comment" then git push.
The outcome is that in my remote repository I have now only the files that were in the original cloned repository (if I made any changes to them, the changes are there), but no files or folders added by me are there.
When I commit files I added after pushing the repository for the first time, they are seen and commited.
Could you help me to push also all the changes I made to the project before pushing for the first time?
Edit: I think the problem lies in .gitgnore file, but I am not sure which lines I can delete and which not:
*.o
*.a
*.dSYM
*.csv
*.out
*.png
*.so
*.exe
*.dll
*.lib
*.dylib
mnist/
data/
caffe/
grasp/
images/
opencv/
convnet/
decaf/
submission/
cfg/
build/darknet/*
build_*/
!build/darknet/YoloWrapper.cs
.fuse*
*.weights
build/*.cmake
build/*.ninja
build/*.txt
build/*.json
build/CMakeFiles/
build/detect_cuda_compute_capabilities.cu
build/.ninja_deps
build/.ninja_log
build/Makefile
# OS Generated #
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
*.swp
# IDE generated #
.vs/
.vscode/
# Managed by CMake
src/version.h
# Build artifacts
lib/
share/
include/darknet/
uselib
uselib_track
darknet
This is link to the original repository: https://github.com/AlexeyAB/darknet
The right way in your case is to use forks.
So, the first step is to fork remote repository, than you can add changes to it, commit and push to your own fork.
You can't add changes and push it to the original repository if you are not the author of such repo, but you can do it with forks.
I upload the whole working folder to git but I cannot access some of my folders.
My local directory:
On GitHub:
Where is my vendors directory?
Assuming that all of the files and directories you have shown were 'committed' and 'pushed' to GitHub, the most likely reason why they do not show up in GitHub is because, as Chris noted in the comments, the resources and vendors directories will not actually be available for adding into a commit if they contain no files.
Let's say I have the following setup:
test/
--test.txt
--test1/
--test1.txt
--test2/
If I run git status after running git init, the following will be displayed:
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
test.txt
test1/
nothing added to commit but untracked files present (use "git add" to track)
Note how test2, despite being present in the directory, is ignored by git entirely, while test1, which contains a file, is noted as having changes by git. The same may be happening to you.
Alternatively, there may be ignore patterns set in a .gitignore, etc (refer to the comments on the question).
git doesn't store folder changes, it stores file changes
Add a hidden file called .keep to each folder
I am new to GitHub and finding it incredibly hard to learn. I am following the instructions here to create new repositories from an existing directory containing the project and typing git init ... etc.
However I created a repository in the wrong place and then deleted it by going into Settings at github.com. Then, when I tried to re-push the files the way I wanted it, one of the subfolders is now black (the one I had just deleted the repository for) and now not clickable - i.e. does not appear to be there. See statistics_project1 in screenshot below.
It's very hard to troubleshoot a problem like this. There is no error message or explanatory text when you hover over the black sub-folder.
This post seems similar but I don't know. The solution looks complicated.
Cannot remove submodule from Git repo
Could someone please tell me what a black 'unclickable' folder means in a github repository?
Cannot remove submodule from Git repo [duplicate] had give the answers and steps to do if you have git installed.
"Via the page Git Submodule Tutorial:
To remove a submodule you need to:
Delete the relevant section from the .gitmodules file.
Stage the .gitmodules changes git add .gitmodules
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Run rm -rf .git/modules/path_to_submodule
Commit git commit -m "Removed submodule "
Delete the now untracked submodule files :rm -rf path_to_submodule"
copy from remove a submodule
In fact the solution was a lot simpler. The 'blackened' folder is in fact the old repo that was not properly removed locally. As recommended by the author of the minimal tutorial I mentioned above, I simply removed the .git subdirectory which contains all git info and then re-pushed the repository to github.com and now everything is back to normal.
I created a BitBucket repository of several Eclipse projects, and then used Eclipse with EGit to clone that repository to a new Eclipse workspace to check whether I had put all of the files into BitBucket right.
The projects in the new workspace contained *.class files in their bin directories, and I realized that I had neglected to delete those files from the Eclipse project directories in the original workspace before adding the projects to the repository.
However, the BitBucket web page for my repository doesn't display any bin directories in the various Eclipse project directories, and when I try to remove the *.class files from the repository that I cloned, I get an error message that says, for example, "fatal: pathspec 'EclipseProjects/IndexerUtils/build/uw_solr/CmdLineOption.class' did not match any files".
I assume this means that the class files are not being tracked, but I'm not sure. I don't know Git well enough to figure out how to find out whether they are tracked or not. Their presence does not cause "git status" to say that untracked files were found, but if I try to remove any of them, Git says it doesn't know about them. In the meantime, BitBucket doesn't display any of the class files in its repository, but when I clone its repository, all of the class files are included in the new repository that is created.
Is there a Git command that can tell you whether a specific file is being tracked or not? If the *.class files are being tracked, how do I remove them, since apparently "git rm " doesn't work? If they aren't being tracked, why do they show up when I clone my BitBucket repository? What kinds of basic diagnostic commands does Git have that could help me figure out what state my repository is in?
Thanks,
Mike
do you have a case collision; try setting following and see if you can see and remove file using git rm command.
git config --global core.ignorecase true
Please note this "git rm" removes file from that commit onwards. If you want to remove file thoroughly please consider filter-branch
example: git filter-branch --tree-filter 'rm filename' HEAD