1

I have already created a git repo to upload my current project files and folder, But it I'am not able to upload new files over. Though I do not get any errors or warnings, but whenever I refresh my git repo it shows no changes.

when on- git push -u origin master Everything up-to-date Branch 'master' set up to track remote branch 'master' from 'origin'.

after refreshing the git page everything is same. Basically I just want to add my node files and folders (contains js and json files). my repo -> https://github.com/Vishal-Kank/DevConnector

2
  • what does git status display? Commented Oct 18, 2019 at 18:47
  • are you adding your files to the staging area? git add . - adds all files, git commit -m "my commit message" Commented Oct 18, 2019 at 18:52

2 Answers 2

2

Follow these commands from start (delete previous .git)
Step 1: open git bash and type git .init (this initializes empty git folder)
Step 2: git remote add origin https://..... (copy the http url of your repo)

Step 3: git add . (this adds all the changed file for commit)

Step 4: git commit -m "first commit" (commit command ,commits the code locally)

Step 5: git push origin master(this will push the code to server(github))
Step 6: git status (check the status)

This will push the code to master branch. If you want to push in different branch than master then change branch before pushing add the command git checkout -b branch-name

For refernce:https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html

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

3 Comments

That's not the correct use of blockquote. Adding, the person want to push local working directory to github. Git clone isn't required. git remote add origin <url> is the command to add remote on local working directory
will keep in mind next time.For sure thanks. @SagarV and, he said he has already created repo..so cloning it to local then again pushing the files
You need git remote add rather than git clone
1

You might need to git add ./file/path so it's actually added to the index. When you create new files or directories, git doesn't track them until you add them to the index. Short solution:

git add . 
git commit -m 'some message here'
git push origin master

Add all files, commit all added files with a message, push to remote master.

Side bar: the -u option on git push sets the upstream repository, you don't have to do that every time.

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.