I had a git repository cloned (Machine1/.../Github/GitM1) on Machine 1 from my Github repository Git1.
I copied the GitM1 folder (complete) on Machine 2.
I ran the project (Machine2/.../Github/GitM1) on Machine 2 and made changes (~1MB) with nothing related to git (even git not installed)
Now, I want to commit these changes to my Github repository Git1.
How to do this (I prefer to do this via SSH key route)?
Thanks.
Edit : on using Jonathan's answer : I am getting this :
On doing a pull asks me remove files (=50+) for merging. I am not sure if this is going in right direction.
答案 0 :(得分:0)
On the "Machine2" copy of the repository...
First, add a remote to GitHub:
git remote add github _github url_
Next, push the change to GitHub:
git push github master
If on Machine2 you want the default remote to be GitHub (so you can just use "origin" rather than "github"), let's clobber any existing origin like this:
git remote remove origin
git remote add github _github url_
See "Working with remotes"
EDIT:
The "update were rejected..." error is because your master branch is behind the master branch on GitHub. Basically...you need to update your master branch.
There are several ways to do this, but a good way would be to rebase your changes on top of the changes on GitHub.
Follow these steps (assuming you set the github remote as above):
git fetch github
git rebase github/master
If there are any code-conflicts Git will tell you. Resolve the conflicts by editing the files and follow Git's instructions.
When you are done with these steps perform the push.