I would like to push a project on github. However I cannot push all the projects. It still some subfolders that are not uploaded. What can I do ?
Only files that are tracked and committed will be 'uploaded' when you push to the remote server.
Check if the folders are added. You can do a git status, and it will list them as untracked if they haven't been added.
Add them. git add [file/folder name]
Commit them. git commit -a -m "Adds [some file]"
Push to your remote. git push -u origin master
Make sure those folders are not ignored. Pick one file in them and type:
git check-ignore -v path/to/ignored/folder/afile
That will print any .gitignore file/rule which might apply and explain why said folder was not added/committed when you dod a git add ./git commit.
Related
I was trying to push the folder on my computer to GitHub. So I created a GitHub repository, and use git bash command line. I didn't push the folder successfully on my first try. Then, I deleted the old GitHub repository and created a new one, and tried using the git bash command line to push code again. However, it shows nothing to commit.
Here is an image to better help understand
According to the image, I understand that you have made a commit but your commit was empty and you did not track any file with git beforehand. You typically want to track the files you want to commit. So in this case you could use git add before committing:
git add .
This should track all files in the current folder after which you could commit and push them:
git commit -m "Some message"
git push
When you create a new repository on git, it shows you how to properly upload data
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/youracc/your.git
git push -u origin main
I accidentally pushed a file to my Github repository, and I am trying to understand where it is.
I have read many posts in here, but none of them had the solution, so I wanted to ask.
My steps were:
git status
git add normal_file.txt
git add sensitive_content_file.txt
git rm --cached sensitive_content_file.txt
#It was the time that I realized I have added a wrong file and need to remove it.
git commit -m "new changes"
git push
I saw that it pushed the "normal_file.txt " into my repository however I have not seen the "sensitive_content_file.txt" in my repository, so I assume it is not being pushed? So that all is okay?
I have tried to clean cache but now my repository complains as:
" Your branch and 'origin/master' have diverged, and have 1 and 1 different commit each, respectively."
However, I did not do any changes to itself.
How can I clear every connection to this file with I tried to remove its caches?
git rm --cached sensitive_content_file.txt before the commit was enough to not pushing it to GitHub.
But now, it would be best to add that file to your .gitignore, in order to be sure to not add it again by mistake:
echo sensitive_content_file.txt>>.gitignore
git add .gitignore
git commit -m "Ingore sensitive_content_file.txt"
git push
If you did any rebase/commit --amend, that would change the local history compared to what was pushed.
If you have not done any local modification, a git reset --hard origin/master would reset master, then you can modify the .gitignore and push.
I have created a repository on github, and run the command line git push -u origin master. I just find a folder over there, but I have a lot of file in my folder, but it only uploaded a folder that has no files in it.
How do I upload a folder with lots of files successfully?
I just tried the command git add . and git push -u origin master
It's not working.
Please me teach me what step I missed. Thanks in advance.
You need to add all of the files in the folder. If you actually want to add all of it (not just some), an easy way to do that would be git add -a or git add ReduxSimpleStarter/*.
Then you need to commit them. git commit.
Then push.
I'm guessing, by your description (sorry, it's a bit hard to read. So correct me if I am missing some details to your problem) you're forgetting to commit the changes.
To do this you need to git commit -m "A commit message". It would look something like this all together
git add .
git commit -m "Added a new button"
git push -u origin master
commit just tells git to save the changes you made to it's history. add just tells git that you want those files (in their current state) to be saved next time you commit.
Hopefully that solves your problem.
It looks like you are not committing your changes before pushing.
When you do this:
git add .
your files are adding to the staging area. But you also need to commit them. You can do this by typing this into you command line after doing the 'git add .' command:
git commit -m "your commit message here"
Then you should be able to type 'git push -u origin master' and your files should upload.
I cloned my repo and made some changes. I tried to push it to github:
git add *
git commit -m "changes"
git push origin master
but it hasn't found my changes. What can I do?
Note that:
git add . is the usual form to add everything in the current directory and subdirectories.
(depending on your shell, '*' might not work as expected. A dot '.' will)
git add -u . would allow you to record the deletion of files.
git add -A . is a shortcut to do both.
I followed these steps: https://help.github.com/articles/generating-ssh-keys
now, I want to create a folder in my github account, is called: "TODO_LIST", and push my project into this folder.
what I should do? I'm located in the folder I want to add.
should I need to do something like the next following?
$ git init
$ git add .
$ git commit -m 'first import'
$ git remote add origin git#github.com:alonshmiel/TODO_LIST.git
$ git push origin master
p.s, I have two SSH keys in my account because I push from two computers.
This is explained in the Create a Repo help page:
Every time you make a commit with Git, it is stored in a repository (a.k.a. "repo"). To put your project up on GitHub, you'll need to have a GitHub repository for it to live in.
[...]
Click New Repository.
Fill out the information on this page. When you're done, click "Create Repository."
[...]
git init
# Sets up the necessary Git files
git add README
# Stages your README file, adding it to the list of files to be committed
git commit -m 'first commit'
# Commits your files, adding the message "first commit"
[...]
git remote add origin https://github.com/username/Hello-World.git
# Creates a remote named "origin" pointing at your GitHub repo
git push origin master
# Sends your commits in the "master" branch to GitHub