3

My friend's project in Git repository, have downloaded 'Git-1.9.4-preview20140929.exe' and installed GIT bash to pull the project to my end, which I did using

$ git clone <with SSH clone URL>

I got the project in my local system, and have done few changes now I want to push the changes back to repository, so I did

$ git init
Reinitialized existing Git repository in c:/users....

and

$ git add .
$ pom.xml
./pom.xml: line 1: project: No such file or directory
./pom.xml: line 2: syntax error near unexpected token `newline'
./pom.xml: line 2: `  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http
://maven.apache.org/maven-v4_0_0.xsd">'

and

 $ git commit -m 'First commit'
 On branch master
 Your branch is ahead of 'origin/master' by 2 commits.
   (use "git push" to publish your local commits)

 nothing to commit, working directory clean

and

$ git push -u origin master:master
Enter passphrase for key '/h/.ssh/id_rsa':
ERROR: Repository not found.
fatal: Could not read from remote repository.

 Please make sure you have the correct access rights
 and the repository exists.

or

 $ git push origin master
 Enter passphrase for key '/h/.ssh/id_rsa':
 ERROR: Repository not found.
 fatal: Could not read from remote repository.

 Please make sure you have the correct access rights
 and the repository exists.

Most of them having a same problem (previous Stack Overflow question/answers) but different reasons, and have tried with those answers but couldn't able to fix the error, please give me directions on this, thanks!

Java.beginner
  • 871
  • 2
  • 19
  • 37
  • Why do you do a `git init`? a git clone already gave you a repo. No need to initialize it again. – VonC Nov 19 '14 at 14:32
  • Thanks @VonC, I was following one the documentation, Is that was problem you reckon? will do it from the beginning again without that $ git init, – Java.beginner Nov 19 '14 at 14:35
  • Also what is the value of the environment variable `HOME` (what does `set HOME` returns?) – VonC Nov 19 '14 at 14:36
  • You should. Launch git-cmd.bat, as I explained in http://stackoverflow.com/a/18679161/6309 or in http://stackoverflow.com/a/15217630/6309 – VonC Nov 19 '14 at 14:44
  • Hi @VonC, I couldn't able to set '%HOME%/.ssh' in environment variables, since I am newbie, struggling to set, please explain me in detail in your free time please, stuck on this for long time, thanks. Have copied my [error](http://i.imgur.com/w8WP4c1.png) – Java.beginner Nov 20 '14 at 14:49
  • Simply launch `git-cmd.bat`, as in http://stackoverflow.com/a/18679161/6309 or http://stackoverflow.com/a/15217630/6309: you can then check that HOME is properly set. Then you can check that %HOME%/.ssh does exist. Then you can ping me again. `git-cmd.bat` is packaged in your msysgit distribution. – VonC Nov 20 '14 at 14:54
  • 1
    you have made a git-cmd.bat? You don't have to make one. It is already there, where you did install Git for Windows. For instance, on my PC, it is at `c:\prgs\git\PortableGit-1.9.0-preview20140217\git-cmd.bat`. Its content looks like https://github.com/msysgit/msysgit/blob/master/git-cmd.bat. "Git for Windows" comes from https://github.com/msysgit/msysgit/releases/tag/Git-1.9.4-preview20140929. – VonC Nov 20 '14 at 16:00
  • 1
    you have made a git-cmd.bat? You don't have to make one. It is already there, where you did install Git for Windows. For instance, on my PC, it is at `c:\prgs\git\PortableGit-1.9.0-preview20140217\git-cmd.bat`. Its content looks like https://github.com/msysgit/msysgit/blob/master/git-cmd.bat. "Git for Windows" comes from https://github.com/msysgit/msysgit/releases/tag/Git-1.9.4-preview20140929. – VonC Nov 20 '14 at 16:00
  • 1
    Simple solution: grab https://github.com/msysgit/msysgit/releases/download/Git-1.9.4-preview20140929/PortableGit-1.9.4-preview20140929.7z, unzip it anywhere you want, and in it, you will find `git-cmd.bat`. Use that one to open a `cmd` session where `HOME` will be defined, and git added to the `PATH` for you. – VonC Nov 20 '14 at 16:28
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/65360/discussion-between-vonc-and-java-beginner). – VonC Nov 21 '14 at 11:53
  • Can you join the chat? http://chat.stackoverflow.com/rooms/65360/discussion-between-vonc-and-java-beginner – VonC Nov 21 '14 at 11:59

2 Answers2

12

After the chat, the right way to configure the link with github is:

cd c:\Users\ramas\dmsproject\dms
git remote set-url origin git@github.com:vamsiannem/dms.git

Then a git push can work.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

I had this problem too but finally I found the file that had edited and not commit in my working area. So after I commit,and like this:

enter image description here

and then I use the git push -u origin master it finished!

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
zifeng
  • 1