GitHub repository folder icon is black and not click-able - github

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.

Related

Uploading project on GITHUB not open the code files [duplicate]

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.

Creating new git repository, can't add directory

I am about to throw my laptop through a wall, and am hoping for help before reaching that point. For reference, I am following these instructions exactly - https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/.
I have a directory ".../path/thisdir". Inside of thisdir are (1) a file called Demo.R and (2) a directory called sportVU. sportVU is a directory with ~15 files in it.
When I follow the instructions in that link, my github repo looks like this:
https://github.com/NicholasCanova/packageSportVU
Notice that the sportVU directory link cannot be clicked in github, and when I download the repo, sportVU is an empty folder. Why is this happening? This shouldn't be so tough.
EDIT: this is what the repo looks like in my local machine, I'm 100% sure it's not empty:
It could be that you have two .git folder in your directory. View hidden folders to see.
Similar questions:
What does a grey icon in remote GitHub mean
Why can I not open my folder in GitHub?
Since Git doesn't store empty folders the steps you should follow exactly are:
Delete the old repo and start again following exactly my steps.
git clone <repo url>
Inside the folder of the cloned repo create a directory manually and name it as you want i.e sportVU.
Drag and Drop all the files you want in the sportVU direcrory.
cd to Myrepo/sportVU and type git add *
type git commit -m "added some files"
git push -u origin master.
and you should be all set

How to ignore eclipse metadata but preserve the template?

I've got an ARM project in Eclipse...Actually, I'm using the STM Workbench packaging of Base-CDT-Eclipse.
I'm working with a few other guys and we're using a git server to push and pull from.
However, everyone has a little bit different setup as far as where their toolchains are, OS's, etc.
This is causing trouble, because we're git dummies, and when we push changes after working locally, we do
git add .
git commit -m "some message"
git push origin master
And when we pull changes, we just do
git pull origin master
And pray that there no one else did anything in the meantime, because we're afraid of merging differences, but that's a different story.
Anyway, this whole project has a few sub directories that include things like datasheets, Word documents, and what-not...but, it also includes the metadata for the Eclipse project. So, the last person to commit also pushes their unique settings for things like tool-chain path, preferred builder, etc. This breaks the other guys' setup and after each pull, everyone else has to manually update their project settings to fix this.
So, what files are special to Eclipse for project settings and how can I tell git to ignore these files if they already exist? They need to be available for, say, a git clone but they need to be ignored for subsequent git push's and git pull's.
If you need the setting file and not rename it and it's ok forsetting file need not to do version control, so there is a way by .gitignore with below steps:
Create a .gitignore file. touch .gitignore
Edit and save the .gitignore file
.gitignore
filename
Remove the caches from version control. git rm --cached filename
Commit and push
You can ignore those files changes locally with:
git update-index --skip-worktree -- .project
git update-index --skip-worktree -- .classpath
See: "Difference Between 'assume-unchanged' and 'skip-worktree'", it should better resist to git pull.
Another option would be to a content filter driver which generates (automatically on git checkout) a .classpath if it does not yet exist.
That allows you to version a .classpath.tpl template, and you can keep your actual .classpath completely private (and in your .gitignore)
See this answer for more.

Github pages missing submodule?

I followed the exact instructions (more than once) to make a github pages site, and I got an e-mail with this error
The page build failed with the following error:
The submodule `msgBored` was not properly initialized with a `.gitmodules` file.
The page it linked me to told me absolutely nothing about how to fix this, I am very new to Github, this is my first time attempting it. Thanks!
This is mentioned in "Page build failed: Missing submodule".
You can see if the submodule initializes with:
cd /path/to/main/repo
git submodule init
git submodule update
But if you don't have any .gitmodules, then it actually is a nested git repo, and you would need to remove that entry before (if you really need it), add it as a proper submodule
cd /path/to/main/repo
git rm mysubmodule # no trailing slash
git submodule add -- /url/to/submodule/remote/repo

Directories of Java class files found in Git repository cloned from BitBucket, but I can't figure out how to remove them

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