fatal: does not appear to be a git repository
Why am I getting this error when my git repository url is correct?
6 Solutions collect form web for “fatal: does not appear to be a git repository”
You’ve got the syntax for the
scp-style way of specifying a repository slightly wrong – it has to be:
… as you can see in the git clone documentation. You should use instead the URL:
i.e. in the URL you’re using, you missed out the
To update the URL for origin you could do:
git remote set-url origin firstname.lastname@example.org:/gittest.git
I met a similar problem when I tried to store my existing repo in my
Ubunt One account, I fixed it by the following steps:
Step-1: create remote repo
$ cd ~/Ubuntu\ One/ $ mkdir <project-name> $ cd <project-name> $ mkdir .git $ cd .git $ git --bare init
Step-2: add the remote
$ git remote add origin /home/<linux-user-name>/Ubuntu\ One/<project-name>/.git
Step-3: push the exising git reop to the remote
$ git push -u origin --all
This is typically because you have not set the origin alias on your Git repository.
git remote add origin URL_TO_YOUR_REPO
This will add an alias in your
.git/config file for the remote clone/push/pull site URL. This URL can be found on your repository Overview page.
my local and remote machines are both OS X. I was having trouble until I checked the file structure of the git repo that xCode Server provides me. Essentially everything is chmod 777 * in that repo so to setup a separate non xCode repo on the same machine in my remote account there I did this:
- Login to your account
- Create a master dir for all projects ‘mkdir git’
- chmod 775 git then cd into it
- make a project folder ‘mkdir project1’
- chmod 777 project1 then cd into it
- run command ‘git init’ to make the repo
- this creates a .git dir. do command ‘chmod 777 .git’ then cd into it
- run command ‘chmod 777 *’ to make all files in .git 777 mod
- cd back out to myproject1 (cd ..)
- setup a test file in the new repo w/command ‘touch test.php’
- add it to the repo staging area with command ‘git add test.php’
- run command “git commit -m ‘new file'” to add file to repo
- run command ‘git status’ and you should get “working dir clean” msg
- cd back to master dir with ‘cd ..’
- in the master dir make a symlink ‘ln -s project1 project1.git’
- run command ‘pwd’ to get full path
- in my case the full path was “/Users/myname/git/project1.git’
- write down the full path for later use in URL
- exit from the REMOTE MACHINE
- create a project folder somewhere ‘newproj1’ with ‘mkdir newproj1’
- cd into it
- run command ‘git init’
- make an alias to the REMOTE MACHINE
- the alias command format is ‘git remote add your_alias_here URL’
- make sure your URL is correct. This caused me headaches initially
- URL = ‘ssh://email@example.com/Users/myname/git/project1.git’
- after you do ‘git remote add alias URL’ do ‘git remote -v’
- the command should respond with a fetch and push line
- run cmd ‘git pull your_alias master’ to get test.php from REMOTE repo
- after the command in #10 you should see a nice message.
- run command ‘git push –set-upstream your_alias master’
- after command in 12 you should see nice message
- command in #12 sets up REMOTE as the project master (root)
For me, i learned getting a clean start with a git repo on a LOCAL and REMOTE requires all initial work in a shell first. Then, after the above
i was able to easily setup the LOCAL and REMOTE git repos in my IDE and do all the basic git commands using the GUI of the IDE.
I had difficulty until I started at the remote first, then did the local, and until i opened up all the permissions on remote. In addition, having the exact full path in the URL to the symlink was critical to succeed.
Again, this all worked on OS X, local and remote machines.
I had a similar problem when using TFS 2017. I was not able to push or pull GIT repositories. Eventually I reinstalled TFS 2017, making sure that I installed TFS 2017 with an SSH Port different from 22 (in my case, I chose 8022). After that, push and pull became possible against TFS using SSH.
I have a similar problem, but now I know the reason.
After we use
git init, we should add a remote repository using
git remote add name url
Pay attention to the word
name, if we change it to
origin, then this problem will not happen.
Of course, if we change it to
py, then using
git pull py branch and
git push py branch every time you pull and push something will also be OK.