zummon
zummon

Reputation: 986

not be able to commit and push a project to GitHub

I already have a project on GitHub and I'm able to clone and got the files as I wanted.

I'm using clone from

Clone worked

Got the files and the .git folder

Get worked

But when I push back by clicking the check mark (commit) nothing happens

Push NOT WORKING

I usually upload files manually to GitHub website but my project is getting bigger, so..

Did I miss something about commit and push to GitHub??

Upvotes: 5

Views: 3063

Answers (5)

ashu
ashu

Reputation: 328

I can see that you are using VS Code to clone and commit changes. I followed the below process and this works for me.

  1. Cloned project (CTRL+SHIFT + P) -> git clone and gave git repo URL
  2. Updated a file in the git repo
  3. Selected the Source Control icon to look for the changes in current repo
  4. Clicked on modified file (it will be visible with yellow colored M letter)
  5. There will be a plus mark, click that and stage the change
  6. Staged changes will be shown at the top
  7. Select the file and click on check mark to commit the changes and enter the commit message

Hopefully this works for you as well

Upvotes: 0

Jewel Rana
Jewel Rana

Reputation: 2786

try to use terminal/gitbash .

Here command .

check your status - if you have any changes you see here

git status

git add .                  // for adding changes data to git
git commit -m "commit here"
git pull                // check first you have any updated or not.
git push origin master // master replace your branch name

Upvotes: 0

RobyB
RobyB

Reputation: 1416

Usually, to have an overview of the changes you've made this command:

git status

is pretty useful and clean

And:

git log

to see the last commits made by you or other people

And then to add the files, and commit

git add [FILES]
git commit -m "Message.."
git pull
git push

Upvotes: 1

VonC
VonC

Reputation: 1323793

You need to go to to Settings -> Extensions -> Git -> Post Commit Command, and choose "push" from the dropdown.

Only then clicking the tick (commit) will trigger a push automatically.

By default, committing would remain a local operation.

Upvotes: 2

Daemon Painter
Daemon Painter

Reputation: 3470

Using git through a GUI usually adds confusion instead of being helpful. One should try to get the git basics right in the first place.

A normal routine should be the following:

1. Clone project
2. Checkout a working branch
3. Make changes
4. Commit changes
5. Push changes

This routine is usually expanded and is cyclic like so:

1. Clone project
# for each new activity
  2. Checkout a working branch
  # each day
    2b. Git fetch          // will get new content from remote, updates you on what your colleagues are doing         
    3. Make changes
    4. Commit changes
    5. Push changes

It appears in your case you didn't do at least one of these steps.

Please note that "uploading manually files on GitHub" is jargon for: "create new commit with a specified commit message and the files added to the staging area via GitHub GUI, sign off the commit with the GitHub user name and email".

This is important, since on your local machine you'll have to git pull, otherwise you'll be creating commits on a diverging history.

This should be an explanation on "what to do" and "how you get in your situation in the first place". It is probably out of scope to add more details in this answer, but please do let me know in the comments.

Upvotes: 2

Related Questions