-1

After cloning remote repository to my local repository,i modified data .Then i would like to push into same repository from where i cloned. how to push..?

knocknock
  • 46
  • 1
  • 2
  • 7

2 Answers2

3

If you are one of the contributors you should be able to do just git push after you committed all your changes. If you are not a contributor there, you cannot push anything to remote repo(you need to get access from creator), but what you can do is to fork that repository to your github/bitbucket/whatever, change you local remote and than push it there.

It the answer would be less abstract if I saw actual error which you have, but the following links should help.

https://help.github.com/en/desktop/contributing-to-projects/committing-and-reviewing-changes-to-your-project

https://help.github.com/en/github/using-git/pushing-commits-to-a-remote-repository

https://help.github.com/en/github/getting-started-with-github/fork-a-repo

https://help.github.com/en/github/using-git/changing-a-remotes-url

Tim Nimets
  • 348
  • 2
  • 9
1

If you've cloned into a new repository then the act of cloning adds a remote, this remote is the connection to your remote repository. You can see which remotes are available by running:

git remote -v

Generally you'll just see two lines for origin one for fetch, the other for push. If you run git push in your repository at this point you'll push any commits that you have made locally to the remote that is pointed at by origin.

Now if you've pulled another repository into a local repository, for example: repository B and C are both repositories forked from repository A then you can pull changes from B into C or from A into C but you may not have remotes setup. In this case to setup a remote you need to use git remote add like so (assuming you have cloned repository C originally, and that is your origin remote):

git remote add repository-B ssh://your-git-server.example.com/repository-B.git

This will add another remote that points to repository B. At this point you can push and pull from this repository by mentioning it in your push and pull commands, like so:

git push repository-B
git pull --rebase repository-B
mcrute
  • 1,592
  • 1
  • 16
  • 27