Issue
So I'm new to both git and ssh, so some basic terminology might be wrong in what I'm saying.
I'm trying to copy (with scp
) my repository (I also backup this repo via github,so it has a .git
folder) to a remote machine that I access via ssh.
It always worked before.
Then I added another branch from master
and kept working on the code on that new branch.
I don't know of anything other I changed that could be significant here.
Anyways, now the old scp -r
command to copy the repository to the remote machine uploads my normal files but it fails in ".git/objects
":
scp: /scratch/petzi/remote/meins/.git/objects/43/50c1b2c7306710fad08153c12fd4a394aef0fc:
Permission denied
And the equivalent message for all kinds of files (maybe even all, I haven't checked) in "objects
".
How can I get past those error messages?
Solution
Why do you scp -r
the full repository each time? Git has been developed to synchronize the code between multiple machines, but you are using scp
do to it (although you are using git).
If you want to keep code synchronized between two machines and you already have a git repository in github, then just use the github repository as a canonical repository to synchronice your machines.
Asumming you already have a git repository in the remote machine. After you made changes in your local machine:
- commit your code
- push your code to github (something like
git push origin master
) ssh
to your machinecd
to the git repository path- get your code from github (something like
git pull origin master
)
Answered By - fifoq