I've just installed Eclipse for PHP (Luna).
I'm trying to have the IDE to clone a git repository (bare) from URI.
So I did :
File > Import... > Projects from Git > Clone URI
First weird thing is I can't use SSH as the protocol (although it's in the list), and I need to use SFTP otherwise Eclipse says it can't connect.
I've given an URI of this type :
sftp://my_user#my_server_ip/path/to/my/repo.git
Then I selected my branches (tried selecting one or more master / HEAD)
Defined destination path, tried to check or uncheck Clone submodules.
Then it starts cloning.
Everything seems fine, until I get this error :
Git repository clone failed.
Cannot download 3d4d4abed8044e6d20c70ff4053e8af30713f0fe
Hitting the "Details >>" Button doesn't help more and basically says the same thing.
Now when I go to my destination folder I have nothing but the .git folder with objects and refs.
I thought maybe a data file was too big or something, so I checked on my server :
cd /path/to/my/repo.git
find ./ -name *3d4d4abed8044e6d20c70ff4053e8af30713f0fe*
# this outputs nothing, but taking a part of the hash :
find ./ -name *44e6d20c70ff4053*
# outputs : ./objects/3d/4d4abed8044e6d20c70ff4053e8af30713f0fe
Which seems absolutely weird to me because that's the exact same hash except for the few first characters :
3d4d4abed8044e6d20c70ff4053e8af30713f0fe
4d4abed8044e6d20c70ff4053e8af30713f0fe
And magically, these non-matching chars are "3d" which is the name of the folder containing the binary file.
I've tried cloning the project with a linux box :
git clone ssh://user#ip/path/to/project.git
It worked like a charm.
I've tried to clone another git repository (non-bare) with Eclipse, and this it asked me for my password, which I gave and then it said it couldn't connect to the server (?!) (I've tried giving a wrong password, and in this case it asks again for the password).
URI : sftp://my_user#my_server_ip/path/to/my/second_repo.git
ERROR : "An error occured when trying to contact sftp://....../second_repo.git. Possible reasons : Incorrect URL
And again, this exact same URI (except I replaced sftp with ssh) worked fine on a linux box.
cd /tmp/
git clone ssh://my_user#my_server_ip/path/to/my/second_repo.git
>> Cloning into second_repo
>> ...
Any idea on what to do from there?
I don't get why one project starts to checkout and for the other (which is on the same server but is just "non-bare") a connection error happens?
Alternatively, could anyone point me an IDE supporting PHP, HTML, JS, and Git ? (please do it as a comment, not an answer unless it's really elaborated).
Thank you.
EDIT :
I have my answer to my second question : to clone, EGit is looking for an "objects" folder in the remote repository, so obviously that couldn't work with a "non-bare" repo.
I had similar problem with Eclipse Luna 64-bit for Java, so i downgraded to Kepler, please give it a try and let me know if it helps.
In my case the proble was the url. Because not was a project git. Example
I was trying with : https://github.com/pkainulainen/spring-mvc-test-examples/tree/master/controllers-unittest
but the previous link was wrong, because was son of the father project
the father proyect was: https://github.com/pkainulainen/spring-mvc-test-examples
Related
What is the right sintaxis for running git clone command on an Azure function powershell 7.0?
Im trying with: git clone <repo https>
and also adding the path at the end git clone <repo https> /.
i get the following error message:
`Command 'starter.cmd git clone https ...' was aborted due to no output nor CPU activity for 60 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed.`
*Update:
Also tried with git clone https://username:password#github.com/username/repository.git
Cloning into ''...
fatal: unable to access 'https://github.com//.git/': URL using bad/illegal format or missing URL
I have'nt found any documenation on this... is it even possible?
I'd first ask what you're trying to achieve by doing this as it's a bit of an odd scenario and there may be a better way of cloning a repo as part of a pipeline and publishing the content with your Function.
If you really must go this route I would look at downloading the repo/branch content with Invoke-RestMethod/Invoke-WebRequest instead and unpacking to the underlying directory structure.
Invoke-WebRequest -Uri 'https://github.com/$owner/$repo/archive/$branch.zip' -OutFile '$repo.zip'
or using the .NET approach like Matthias pointed out in this response:
https://stackoverflow.com/a/48547954/12040634
I am building a web application for an online "build your own" card game. In the application, I have a cards.json file that holds custom card data. This file is changed with fs whenever a user creates a card. Whenever I push local changes, the cards.json file gets overwritten on deploy. That means all the remote data gets lost on every deploy. How can I include a cards.json file remotely but not change the file whenever I push changes using git push heroku master?EDIT: I guess for clarification reasons, I have tried using a .gitignore as well as removing the file from the staging area. I'm not entirely sure, but I think the issue is that when the application is deployed the file is overwritten there.
So I just found out that the data created during runtime will always be deleted/reset.
https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem
I guess the best fixes for anyone else who has this same issue are:
a) Look into Databases and Heroku Add-ons, or
b) This is very workaround, and there might be better ways to do it, but:
// Go into a new directory, and use
$ heroku ps:copy <FILENAME> --app <APPNAME>
// Then, copy+paste the data from this file into your main repo.
/* Now, each time you do this, you need to make sure you delete that file from the
* extra directory you created as ps:copy only works when the file doesnt exist locally.
*/
I think git fetch doesn't work in this instance, as it only pulls that unchanged file, rather than the changed one from the dyno.
Look up the .gitignore file in git, seems to me that's exactly what you're looking for.
If it doesn't recognize .gitignore properly at first:
git add [uncommitted changes you want to keep] && git commit
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
In .gitignore add the cards.json along with the path .
eg. src/test/resources/testdata/cards.json
I'm following instructions for a kernel project and am told to:
Export the kernel to use from the repository at the URL:
git://git.yoctoproject.org/linux-yocto-3.14
You will need to switch to the 'v3.14.26' tag,
So I did:
git clone git://git.yoctoproject.org/linux-yocto-3.14
Once the project downloaded, I typed in:
git checkout 'v3.14.26'
and was greeted with a message about how I'm now in detached HEAD state. It also output the following:
HEAD is now at 356a3e1... Linux 3.14.26
But it seemed weird that nothing in the project downloaded or changed; I ran show-branch and was told [master] Merge tag 'v3.14.24'
So is the project actually at version 3.14.26 or not? I don't really get what's going on, though I think I understand what's happening with detached HEAD after reading about it. I'm not going to be making any changes to the solution, I'm just following the guide to use the specific 3.14.26 version of the kernel.
Keeping things simple, HEAD will only be attached if it's pointing to a Branch (something you can commit to). When you point your HEAD to a Tag, your working copy will be based on that commit, but since you cannot commit to a Tag, it will tell you are detached.
To make sure you are where you think you are, run:
git log --decorate=short --oneline --branches=*
If it places HEAD on the same commit as v3.14.26, you're good. Example:
λ git log --decorate=short --oneline --branches=*
bdeddd5 (origin/master, origin/HEAD, master) XXX
5250588 YYY
647f007 ZZZ
d5cc025 (HEAD, tag: v3.14.26) WWW
55736b0 PPP
I've created a user on gitLab.com and created a new (currently empty) project.
I then downloaded the community edition and installed onto my local machine. I can happily navigate to http://localhost/dashboard/projects and would like to 'import' the project I created on the gitlab.com
I've followed the instructions on my local server for http://localhost/help/integration/gitlab but something is clearly not working out as I never get an option to 'login via gitlab.com' after I have restarted the gitlab app locally.
Here are some details of the setup
gitlab_rails['omniauth_providers'] = [
{
"name" => "GitLab.com Oath _ to local",
"app_id" => "from the app ID on GitLab.com",
"app_secret" => "from the app secret on GitLab.com",
"args" => { "scope" => "api" }
}
]
The app settings on the server are as follows.
Name : GitLab.com Oath _ to local
appId : crazyLongNumberID
appSecret : crazyLongSecretNumber
Callback URL :
http://localhost/import/gitlab/callback
http://localhost/users/auth/gitlab/callback
Is there anyone who could give me a gentle shove in the right direction to solve my problem.
Thanks in advance.
David
So I don't like answering my own questions, but...
so I was being a tad dopey.
the trick was to use git to create a clone of the projet that I had created on my local gitlab instance. Note that this has to be done with the http not ssh version for the project.
git clone http://localhost/davem/projectName.git
This creates a sub folder of projectName in the directory where i ran the git command.
Then add some files (such as a readme) and then commit this back to the local instance with git push
git commit -m "add README"
git push -u origin master
Then to link things over to the main gitlab.com site (assuming that you have called the project the same thing.
git remote add gitlab.com git#gitlab.com:YourUserName/projectName.git
this adds in the remote project and also gives the server an 'alias' of 'git#gitlab.com' so now we can push to this server with:
git push gitlab.com
If I have correctly understood, you can have multiple named servers to push to. eg if you have a colleague who has their own gitLab.com site you can add them as well to with something such as...
git remote add FriendsName git#gitlab.com:FriendsName/projectName.git
and now you can push to them with just
git push FriendsName
I clearly haven't tested this yet... but I'm guessing this is how it should work. To see the aliases that you have set up use
git remote -v
I'm now a happy bunny rabit, and ready to set up some more stuff elsewhere. If I'd made any bad assumptions in here, please feel free to edit accordingly.
David
I'm on a fresh install of Linux Mint.
I'm getting the following error when trying to push from any repository:
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 8 in /home/leng/.gitconfig
fatal: Could not read from remote repository.
This is very odd, because I definitely have a version that supports the simple push behavior.
The output of git --version is git version 1.8.3.2.
The contents of ~/.gitconfig:
[user]
name = My Name
email = MyEmail#website.com
[color]
ui = true
[push]
default = simple
Here's where it gets creepy.
If I change the behavior to matching (or to nothing, tracking, or current, for that matter), then attempt to push, I get the same exact error message. How is that possible? Is it caching the config somehow? I've even tried rebooting. I've even tried purging GIT completely from the system (and deleting ~/.gitconfig) then reinstalling it.
If I delete the [push] section completely from the .gitconfig file (or if I delete the file entirely), then try to push, then I get this:
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
error: Malformed value for push.default: simple
error: Must be one of nothing, matching, tracking or current.
fatal: bad config file line 8 in /home/leng/.gitconfig
fatal: Could not read from remote repository.
...so it appears to be both acknowledging that I haven't chosen a pushing behavior, but then also saying that I've chosen an unsupported behavior. What on earth is going on here?
I even get the error if I delete ~/.gitconfig completely.
Can anyone help me out with this witchcraft?
Thanks!
EDIT:
Here is a .git/config file requested:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ssh://{my remote repo}
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
Okay, so I fixed it, but the method is absolute witchcraft.
I tried to isolate the problem by purging GIT, deleting the config file, reinstalling GIT, then creating a local bare repository, then cloning it, then attempting to push from there. Pretty much like this:
sudo apt-get purge git-core
rm -f ~/.gitconfig
sudo apt-get install git-core
cd /git
mkdir foo
cd foo
git init --bare
cd /var/www
git clone /git/foo
cd foo
touch blah.txt
git add -A
git config --global user.name "Name"
git config --global user.email "user#email.com"
git commit -m "Blah"
git push
...same exact error message, no change there. (Still some serious witchcraft.)
Then, I deleted one of my repositories that doesn't have a local origin (it connects to its origin via SSH) and cloned the repository anew after deleting it (with a fresh git clone ssh://... command).
I got an error from the clone command:
remote: Malformed value for push.default: simple
remote: Must be one of nothing, matching, tracking or current.
Ah ha! Now it says remote instead of error. So the remote doesn't support this behavior. (That doesn't explain why the error persists on local-only repositories with local origins, then, though.)
So I then SSH'ed into the remote server and updated the git-core there to the latest version, re-attempted to clone the repository from my local machine, and it worked.
Now, I can finally git push. Insanely, this also fixed it so I can git push from the entirely local /var/www/foo to the also entirely local /git/foo (the local origin bare repository). SSH'ing into this remote server and updating it somehow - WITCHCRAFT - fixed my local machine's error.
Why on earth the entirely local repos care about an entirely different machine's GIT version is... beyond me. How utterly, utterly insane.
I had the same error message on git push.
For me it turned out that the remote user's git was an older version (1.7.2.5),
and I had recently updated the remote ~/.gitconfig to include:
[push]
default = simple
The solution was to remove this setting from the remote's configuration.
Since it seems other people are having this issue, and I found a solution HERE, I thought I'd post the solution that worked for me.
IN SHORT:
The solution I found was at this page. Evidently the best solution is to upgrade to a newer version of Git (if possible). That was not an option for me, however. From a local machine, I typed the following command:
git config -–global push.default upstream
This got rid of the Malformed value for push.default: simple error I had been getting. I'm not entirely sure what upstream does, however.
MY CONTEXT (for comparison): I had an empty (bare) repository on a remote computer, and I had a few repositories on a couple "local" workstations. I pull from the remote repository, do some work, and then push my work to the remote repository. Pushing/pulling was accomplished via SSH. Most of the time, while working on a local machine, pushing/pulling would result in the error described above.
In short, before the fix, I had the following ~/.gitconfig file on the remote machine:
[user]
name = Foo Bar
email = FooBarPerson#email.com
[diff]
external = /Users/foobar/bin/git-diff-cmd.sh
[color]
diff = auto
status = auto
branch = auto
[push]
default = simple
After entering in the above command, my ~/.gitconfig file on the remote machine changed to:
[user]
name = Foo Bar
email = FooBarPerson#email.com
[diff]
external = /Users/foobar/bin/git-diff-cmd.sh
[color]
diff = auto
status = auto
branch = auto
[push]
default = upstream
Version information:
Remote machine (repository location): 1.9.4
My laptop: 1.8.5.2 (Apple Git-48)
Other computer I work on: 1.7.7.4
Here's another site that may be useful to some people:
http://www.lorrin.org/blog/2011/10/03/argumentless-git-pull-and-git-push/comment-page-1/