Can anyone please tell me why i have the grey icon when i push my files to github ? In side the app directory, there should be models, views , and controllers but in the remote GitHub I can\'t click in.
问题:
回答1:
It looks like you created a submodule, pointing to an unreachable remote location.
See this answer. That icon, when green, will point to the sub module. I\'m assuming it\'s greyed out in your case because the sub module was incorrectly configured.
Given that .gitmodules
is not present, it must have been deleted, leaving a sub module without a remote information.
If go into app
and type git remote -v
you will see where this module is pointing too. This place is currently unreachable.
In a similar scenario, I added a submodule and deleted .gitmodules
. The result on GitHub looks like this:
回答2:
git rm --cached <folder_name>
Then go to the parent directory and do:
git add .
git commit -m \"<your_message>\"
git push --all
回答3:
It looks like you initialized git inside the folder. Delete the git file (rm -rf) from the subfolder and create a new repo and re initialize git.
回答4:
You have already initialized git inside the app directory and it can\'t find the remote. Delete the .git file inside app..
[app(master)]$ sudo rm -r .git
Or show the hidden files inside the folder and do it manually. Then re-commit & re-push the changes of the parent folder
回答5:
The easiest method I found was simply to remove the folder from local and update the remote repo. Navigate to your local directory and cut the folder containing the incorrectly set up .git subfolder to another location (outside the local repo, eg desktop) so you can correct the issue and copy back in later, then run:
git submodule update
git add --all
git commit --all
git push
This should remove the folder that is greyed out on the remote repo. Then copy the folder back in again in your local files and run the add --all commit --all git push as above, taking care of course first to delete the incorrectly set up .git folder from the subfolder beforehand to avoid the same issue again; to locate this on linux systems use cntrl-h from within the folder to view hidden files in your folders, you\'ll see a .git folder present in a subfolder that is causing the issue, simply delete that and that should resolve
回答6:
It already has a .git inside it and hence appears grey. i.e it has git initialized inside it as well.
回答7:
In my case I had initialized a git repository in the root folder (the one that has manage.py) when deploying to Heroku before setting up a Git repository in the parent folder of the project.
When I then created a new repo in the project\'s parent folder, the root folder handling the models views and controllers was grayed out. The following worked for me:
- Delete parent folder repo
- Create new repo without checking \"Initialize this repository with a README\" since we will be importing the existing repository.
Within your root folder the one with manage.py, do the following :
git remote add origin \"github repo link\"
git push -u origin master
- Refresh your Github repo and all your directories should be present
回答8:
Git thinks it\'s a submodule as it has a .git directory inside it. To fix...
Changed directory to the offending dir:
cd <offending git submodule>
Remove the .git directory inside it:
rm -rf .git
Update the git cache:
git rm --cached <offending git submodule>
Go to the parent directory:
cd ..
Add the directory to git:
git add .
git commit -m \"Changed submodule to directory\"
git push --all