Pushing to collaborator's private repo from terminal

I’m trying to collaborate with a colleague on their private repo using terminal, not any desktop GUI. I was able to pull their repo down to my local machine and edit in Atom, but when I try to push my changes with ‘git push’, I get: 

fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin master

So I run that command and get:

remote: Repository not found.
fatal: repository ‘https://github.com/[me]/[project].git/’ not found

So, I try to set the upstream origin master by:

git push --set-upstream origin master git@github.com:[colleague]/[project].git
error: src refspec git@github.com does not match any.
error: failed to push some refs to ‘https://github.com/[me]/[project].git

I don’t get why this is happening. Essentially I want to use my GitHub account, which is logged in on my terminal, to work on their private repo, without cloning it into my own GitHub which is a public account.

My hypotheses:

  1. That I’m writing incorrect commands (true either way of course).

  2. That I may not have push access to their repo - though I have been given collaborator access.

  3. That I’m unable to work on their repo without cloning into my own GH account.

Any help is appreciated - thanks kindly.

Most likely this is happening because the origin remote is set to point to someplace that isn’t their private repository. You can check the status of all remotes with git remote -v and set the URL of any remote with git remote set-url [remote name] [url].

I hope that helps!

1 Like