Problems trying to commit or push to git on server from client


Active Member
Hi all,
Firstly, I hope this is a reasonable place to post this question. It looked like the most appropriate forum, but I DID debate putting it in
the DevOps forum.
Anyway, I've got a server and a laptop client. I've generated and setup the SSH keys and that part seems to be fine. I've installed git on both machinesl and following some tutorials on the web I've got the /home/git directory set it up as a repositiory, etc. I'm going to try to describe the problem I'm having as clearly as I can. I can't tell you ALL of the things I've tried to solve this (it's been hours of reading tuts and trying things), but I'll describe where I'm at.
On my server I have /home/git/devel and I've run init so that the .git files are in the appropiate directories. If I do a git show, it lists the 'devel' object. On my client laptop, I've got /home/me/devel/python/app/krh_itunes_dash and a bunch of files in itunes_dash.
What I wanted to do was make /home/me/devel on my laptop a git repository and EVERYTHING underneath it part of the repository.
So I CD's into /home/me/devel and did 'git init'. Then I did 'git add .' and it looked like it added all of the files in my itunes_dash directory. Then I did a bundh of git 'commits' which seemed to work, but then when I looked on the server nothing had changed. Finally in my stupor, I realized that the commits were probably happening to my LOCAL git repository.
So, did some quick tuting and it looked to me (I could be wrong and probably am) that I need to 'push' the commit out to my server.
So, from my laptop I tried 'git commit push [email protected]"server IP address":/home/git/devel (also tried it with 'devel.git' on the end because of the way one of the tuts was written).
Anyway I keep getting the message that the path is invalid and it calls out everything from '[email protected]' to the end of the command string.
I've tried a bunch of stuff just to try to get SOMETHING to happen, but no joy.
So can anybody just steer me in the right direction here? I have VERY little experience with git. I used it on the job 10 years ago, but I was strictly a user, not an admin.....




Well-Known Member
When working with a remote server, you need to set up the local repository to use the remote repository.

To do this, use the git remote add command in the local repo.
If you’ve set up ssh keys, then use:
git remote add origin [email protected]{server IP/URL}:{username on server}/{repo name}.git
{server IP/URL} - is the URL, or IP address of the git server.
{username on server} is your username on the server
{repo name} is the name of the repo on the server.
Also note: origin is the label for the connection. When using a remote, I tend to use origin as the label for the upstream server.

So for example, when I finally decided to publish my note taking application in a new repo at, I set up a new, empty repository at (called note) and set up my ssh key. Then I used the following command in the main directory for my local git repo for note:
git remote add [email protected]:JasKinasis/note.git
That sets up a remote connection called origin for the local repo and uses the git protocol via ssh to connect to the server.

To push your existing code and history to the server, you can use:
git push -u origin master
As long as everything is set up correctly, that should push the content of the master branch of the local repo to the remote server via ssh.

Then what you do is work on your local branch. After you’ve made a commit to your local branch, push the changes upstream to the server using the push command above.

Alternatively, if you’re going to set up ssh keys later - you could set up the initial remote connection to use https:// instead. But that will prompt you for the password for your user account on the remote server each time you push to the server.

So to set up a https connection - you would set up the remote connection using the following git command in the local repo instead:
git remote add origin https://{serveraddress}/{username}/{repo name}.git
So in the case of my note repo, If I wanted to use https://, and set up my ssh keys later, I would have used:
git remote add origin
Then any time I try to push to the server, I’d be prompted to enter the password for my server account.

And when I finally get around to setting up ssh keys, I tend to manually edit the “origin” connection in .git/config.
So, for example - with my note application, if I wanted to change the connection from https:// to git:// (via ssh) - I would change the url setting for the origin connection from:
url =
url = [email protected]:JasKinasis/note.git
I haven’t used git much recently, but from what I recall, that’s pretty much all there is to setting up a remote repo for your projects.
  • Like
Reactions: Rob


Active Member
sorry for the gap, I've been away sick..
I'm still having no luck with this. I went back and removed all .git directories to start over. Here's what I have:
git server:
- there are ssh keys for my remote git user in /home/git/.ssh/authorized_keys
- I have created the directories /home/git/khedger/itunes_dash
- in /home/git/khedger/itunes_dash I have done 'git init'

remote client:
- I have a directory /home/khedger/devel/itunes_dash with a bunch of files in it
- in this directory I've done 'git init', 'git add .', and 'git commit . -m "initial checkin"'
- I then did 'git remote add origin [email protected]:khedger/itunes_dash.git
- then when I do 'git push origin master' I get
fatal: 'khedger/itunes_dash.git' 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.
I've re-checked the keys, .git dirs, etc. and everything seems to be correct. So what am I missing or misinterpreting?



Gold Member
Gold Supporter
Since you are planning to use the remote git repository on the server anyway isn't it just easier to rename /home/khedger/devel/itunes_dash to /home/khedger/devel/itunes_dash_localpc. Then clone the remote repository to /home/khedger/devel: git clone [email protected]:khedger/itunes_dash.git. To then copy all your current files from /home/khedger/devel/itunes_dash_localpc to /home/khedger/devel/itunes_dash. Then git add the files and commit them and then to finally push them to the remote repository by using git push? It's seems you are making it really hard on yourself or I may not be understanding your setup?
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online