vico vico - 2 months ago 20
Git Question

Push local branch to remote

I have created local branch:

git checkout -b tmp1


Now I would like to push this branch to server:

git push remote_tmp1 tmp1


Got error:

fatal: 'remote_tmp1' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


How to push my branch to server?

Answer

You are getting that specific error because you have not added remote_tmp1 as a remote repository.

Add the remote repository first and then retry pushing: git remote add remote_tmp1 https://remoteserver.com/repository.git git push --set-upstream remote_tmp1 tmp1

You can add the remote using https as above or with ssh if available. For example if you're using Github you can use either: https://github.com/username/repository.git or git@github.com/username/repository.git.