2

I have just created new repository on github and trying to add my project on git.

When my friend tried to clone using git clone this project, some files of my project were not cloned.

On inspecting more on this, I found that these files were not added from my side to git. Steps followed by me to add whole project to git:

git add -A
git commit -am "First Commit"
git push origin master

But, still some files were not added to git. I tried by changing permissions of these files from read-only to rwx and adding again. But, nothing changed.

6
  • 2
    Do you have .gitignore? Commented Nov 30, 2017 at 10:30
  • yes, I have .gitignore file @ArkadiuszDrabczyk Commented Nov 30, 2017 at 10:48
  • If I use git add -f -A then .gitignore is ignored and all files are added to git repository. Commented Nov 30, 2017 at 10:49
  • Then how can I pull these files added by ignoring .gitignore to my friend's pc ? Commented Nov 30, 2017 at 10:53
  • .gitignore is only used for add/commit. Your friend does not need to worry about .gitignore if they are pulling files you have already added to the repository. Commented Nov 30, 2017 at 15:16

1 Answer 1

2

My project was having .gitignore file containing list of files and folders that were ignored during git add. So, I again added my project using

git add -f -A
git commit -am "Add Project"
git push origin master

Where

-f : adding files forcefully, ignoring .gitignore

-A : adding whole project

I have not removed anything from .gitignore because I want them to be added only once, not all the time when adding project to git.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.