Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have error when push/pull git

Tags:

git

I am created my exists project from local files. But this project exists in git repository. And now i need commit changes in project and pull/push his, but git don't know what is repository i have master or origin. This is error message:

fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched.

Thanks!

like image 888
Arthur Yakovlev Avatar asked Jan 06 '14 15:01

Arthur Yakovlev


2 Answers

If you initially cloned your repository then:

git push origin master

If you are wanting to push local files to an empty repository you created on github, then:

git remote add origin [email protected]:username/reponame.git

You have to have a connection established to communicate properly. Here is a more detailed answer to help.

Here is a good Git tutorial site.

EDIT: "You push your local repository to the remote repository using the git push command after first establishing a relationship between the two with the git remote add command. If you visit your Github repository, it will show you the URL to use for pushing. You'll first enter something like:

git remote add origin [email protected]:username/reponame.git "

Replace [email protected]:username/reponame.git with the URL from the repository. The URL is located on the right side bar, titled "SSH clone URL".

like image 113
Christopher Ellis Avatar answered Oct 17 '22 23:10

Christopher Ellis


For people whose remotes are already set...

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=<remote>/<branch> <local branch>

This would allow you to simply run "git pull" instead of "git pull origin branch"

like image 2
Mingsheng Avatar answered Oct 17 '22 23:10

Mingsheng