Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to commit to remote git repository

Tags:

git

git-push

I am new to git.
I have done a clone of remote repo as follows

git clone https://[email protected]/repo.git

then I did

git checkout master

made some changes and committed these changes to my local repository like below..

git add .

git commit -m "my changes"

Now I have to push these changes to the remote repository.
I am not sure what to do.

Would I do a merge of my repo to remote ?
what steps do I need to take ?

I have git bash and git gui.

Please advise.

like image 215
Ahmed Avatar asked Apr 28 '12 14:04

Ahmed


People also ask

How do I commit to a remote git repository?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.

How do I commit to a remote branch?

Push a new Git branch to a remote repo Clone the remote Git repo locally. Create a new branch with the branch, switch or checkout commands. Perform a git push with the –set-upstream option to set the remote repo for the new branch. Continue to perform Git commits locally on the new branch.

How do I commit to a repository?

Commit the files staged in your local repository by writing a commit message. You can create a commit message by git commit -m 'your message' , which adds the change to the local repository.

How do I push to a remote repository GitHub?

To push the new commit onto the remote, you need to click on the push button again. Then, click push once more. That's it. Once the commit is pushed to the remote branch, you can see that the origin/master tag gets moved to the same commit as the master tag.


3 Answers

All You have to do is git push origin master, where origin is the default name (alias) of Your remote repository and master is the remote branch You want to push Your changes to.

You may also want to check these out:

  1. http://gitimmersion.com/
  2. http://progit.org/book/
like image 175
zafarkhaja Avatar answered Sep 26 '22 10:09

zafarkhaja


You just need to make sure you have the rights to push to the remote repository and do

git push origin master

or simply

git push
like image 42
Sergey K. Avatar answered Sep 25 '22 10:09

Sergey K.


git push

or

git push server_name master

should do the trick, after you have made a commit to your local repository.

like image 29
haziz Avatar answered Sep 25 '22 10:09

haziz