Use a relative path
With a relative path it'll probably work:
git push AyamJ@sourcecode:pbGIT master
I'm not sure of the reason, but testing with abs paths it fails for me so that is probably the/part-of-the error for you. But that isn't the normal way to use git.
Be normal
First ensure the ssh config is setup such that you don't need usernames and passwords i.e. this should work:
(notebook)$ ssh sourcecode
...
(server)$
On the local git repo - create a remote that points at the remote server's repository:
(notebook)$ git remote add sourcecode:pbGIT origin
(notebook)$ git push
It is deliberate that last command has no arguments - with a recent version of git it'll give an error message like so:
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 <current branch name>
The error message is telling you how to make it so you can push/pull with no arguments, therefore execute that command. With an older version of git the command is the same, there's just no error message. After executing this command, e.g.:
git push --set-upstream origin master
from this point forwards it's not necesssary to use arguments with git push
and git pull
Do it the other way around
When starting from scratch, or if the remote repository already exists, it's actually easier to do these things the other way around
(notebook)$ ssh sourcecode
...
(sourcecode)$ mkdir x.git
(sourcecode)$ cd x.git
(sourcecode)$ git init --bare
(sourcecode)$ exit
(notebook)$ git clone sourcecode:x.git
Cloning into 'x'...
warning: You appear to have cloned an empty repository.
Note that above, the remote git repository has been created in a folder named whatever.git
- this is merely a convention to identify git folders/repositories, it doesn't have any special meaning, though it's likely to be in all examples.
If after that you take a look in the .git/config
file on you'll see something like this:
(notebook)$ cd x; more .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = sourcecode:x.git
[branch "master"]
remote = origin
merge = refs/heads/master
Which indicates that the remote origin points at the sourcecode server, and the one branch that exists, master
, tracks the remote origin
.