Git Push is working via Terminal but not via Xcode - xcode

I've created a remote git repository on my local computer inside Google Drive folder
git init --bare project.git
and added the remote path as follows
git remote add origin '~/Google Drive/git/project.git'
When I commit via Xcode, it rightly shows the push option check box with correct branch (master in this case). I marked it checked and then press 'Commit and Push' and apparently it does so but actually not pushing to remote repository. When I push from 'Source Control -> Push', it shows successful message but my remote repository doesn't get updated.
When I run the push command from terminal then it does update the remote repository successfully.
git push origin master
How to fix so that Xcode (7.1.1) can push successfully?
Edited: A side note, this has troubled me a lot by the time I realized this. As initially, I think it was working via Xcode (maybe some prior version to 7) as well.
Edited: #VonC here is how I know how git push is working. The modified date gets changed for some objects in finder.
Edited: As per instruction by #VonC, now the push is working from Xcode when project.git is moved at different location out of 'Google Drive' folder. But, I want it to work with 'Google Drive' folder.
Edited: I further moved the project.git to a folder with name including space and again xcode is not pushing but terminal is still pushing.

Xcode 7.1 doesn't push to remote repo path with a space but Terminal does provided that the path is enclosed in quotes. Hope Apple would fix it for new releases.
I've got my issue fixed by renaming the 'Goolge Drive' to 'GoogleDrive' and adjusted the remote path accordingly. Google Drive App prompted for missing folder and I pointed it to the renamed one.

my remote repository doesn't get updated.
Try simply to clone that repo repo elsewhere to see if you get back the content you just pushed:
git clone ~/Google Drive/git/project.git /somewhere/else
Don't forget that a bare repo has no working tree, so after a push, you don't see any new file.
Note: if a remote repo path with a space is problematic to XCode, a possible workaround would be to push to a path without path:
either one which is a symlink to Google Drive
or a path which is rsync'ed after to Google Drive

Related

Configure git to be accessed in my network from portable HDD under Windows

I need to have a portable git setup in order to access a git repository in my LAN from a portable HDD, including the computer where the HDD is connected, under Windows. The HDD might be moved from time to time between the computers in my network. I wish to avoid SSH for the moment.
I have installed the portable version of the git, I have made a batch to set the PATH to the requested directories specified in the documentation before running git-bash or git-cmd.
I see it runs, I have made a bare repository, let's say in a path like m:/repo.git. Then, I got stuck as I don't know how to configure the remote in order to do the first push as `git push repo master' from my project path.
I think I should do a 'git remote add repo ' but I fail to set the correct URL or something. I am aware I should change the URL each time the HDD is moved or change the remote.
What are the correct setup steps?
Then, I got stuck as I don't know how to configure the remote in order to do the first push as `git push repo master' from my project path
Let git create that setting for you:
git clone m:/repo.git
cd repo
git --work-tree=..\myproject add .
git commit -m "first commit"
git push
That will import the files of your project in a local repo, which will be able to push back to your bare repo on M:\.
UNC paths are supported too
git.exe clone "d:/dev/SDK" "//comp1/Proj/git/SDK/"

something went wrong when pushing to github with webstorm

As is shown in the image,I'm not sure if the failure is caused by some missing property while setting up webstorm .
The issue is not resolved after a lot of efforts.As a learner,I don't know what to do now.
Meanwhile,something seems wrong as shown in git bash.I've no idea whether the two are directly related.
If you have ever faced these difficulties,could you please give me some idea? Even if it's only a web address.
What I want to do is only pushing my code. Anyone who pushed successfully in any other way will be welcomed to share your method.
If I'm being honest I'm not sure that I completely understand your question, but I will supply some information that will hopefully lead you down the right track.
First in the bash shell, cd (change directory) into your project directory like this:
$ cd /c/foo/bar/yourprojectfolder
In your project top most directory, do you have a .git folder? You may have to show hidden folders in windows to see this directory. If not, you need to initialize a repository with the init command.
$ git init
Initialized empty Git repository in C:/foo/bar/yourprojectfolder/.git/
After running this command, you should see a .git folder inside of the directory you changed to (used cd to get to) earlier.
Next, in order to push, you first need a remote repository to push to. Based on your first picture, I believe that you have successfully created a repository on GitHub. If not however, just log into GitHub and click the 'New Repository' button:
Once a repo has been created, you need to add it as a remote to your local git (in git bash). To do this you need a url (either SSH or HTTPS) to your repo. You can find this url inside of your repository in online GitHub. If you are not certain you have set up SSH, it's best to use the HTTPS url. It should look something like this, but the url itself will be different and specific to your repository:
Copy that url to your clipboard, and then back in git bash run:
$ git remote add origin <PASTE YOUR URL HERE>
You need to make an initial commit of your code to have something to push:
$ git add .
$ git commit -m "Initial commit"
Finally, with the origin repo set up and a commit made, you should be able to push to your origin repo
$ git push -u origin master
You should now be able to view your code on GitHub.

Cannot clone GIT repository on network drive

Using Windows 7, we have a bare GIT repository set up on a network drive so that multiple users can pull/push from it. I am able to create a new working repo on my local and multiple other networked drives. However, when I try to clone a new working repository on the same network drive (different folder) , it fails.
Using TortoiseGIT, after I right-click and choose "GIT Clone", put in all of the necessary paths to my bare repo (the new working repo is already filled in) and hit ok, I get the following error:
Cloning into 'R:\path\to\new\repo'... done.
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistent object 5d2164db2c61efc7a5598f6ff75ed3fbbb12456e
fatal: Cannot update the ref 'HEAD'.
fatal: The remote end hung up unexpectedly git did not exit cleanly (exit code 128)
and it fails to create the repo. It does however build the new folder & ".git" subfolder structure.
It's not a r/w permissions issue because I can r/w any other files, but just cannot seem to create this newly cloned repo. My co-worker cannot either. Even if I got to another folder on the network drive, I still cannot clone the repo successfully. Surprisingly, if I just copy/paste a repo I created in another location, then manually do a "pull", it works and updates successfully.
Any ideas on what to try next? Obviously I've Googled "exit code 128" and "cannot update the ref 'HEAD'" but cannot find a solution to my issue. It's probably something really simple that we are overlooking, but we're just getting started with GIT and this is really causing us headaches...
UPDATE: I just noticed that when I do a manual pull from GIT to my "copy", it is doing a Fast-Forward. Maybe this provides some additional clues?
From R:/path/to/repo
* branch master -> FETCH_HEAD
Updating 5d2164d..d75bdb7
Fast-forward
Files.py | 3 +++
1 file changed, 3 insertions(+)
Success
Git might be trying to do some smart stuff with hardlinks that fails on the network drive. Try using git clone --no-hardlinks /r/path/to/my/repo or git clone file:///r/path/to/my/repo
Please do this via command line in msysgit
git clone /r/path/to/my/repo /r/some/other/path
Further, I would recommend using git from the command line as it is a tool that was designed to be used from the command line. You will be able to find more help, faster, with any issues that come up for you.

Xcode 4.4 - no remotes found

Post-installation of 10.8 and Xcode 4.4 when I try to push to a remote using the Xcode integration Xcode is telling me 'no remotes found'. I am still able to push successfully via command line so my actual repositories are fine. I've installed the command line tools and have tried restarting Xcode several times. Additionally, if I go to Organizer and try to select the repository all I get is a spinning activity indicator. If I select 'remotes' for a given repository it's blank. Note that Xcode does recognize git is available though as it does show which files are modified and allows commits. Reported system git version in /usr/bin/ is:
git version 1.7.9.6 (Apple Git-31.1)
Is anyone else experiencing this, or do you have any suggestions for a remedy (or at least a place to look at a log to see what is going wrong)?
UPDATE 10/18/13
This issue has been resolved in Xcode 5.
When you add the remote repository in Xcode or in command line (doesn't matter from where you add it) make sure that you use the full path for your repository.
E.g.:
From commandline it's enough to specify
git remote add <name> gituser#gitserver:example.git
when your example.git is located in gituser's home directory. However Xcode can't deal with this annotation and says "No remotes found" when you try pushing your commits to this remote repository.
In order to satisfy Xcode you should type the whole path like:
git remote add <name> gituser#gitserver:/home/gituser/example.git
I have found this solution for Xcode with Git:
Organizer > remotes > origin
1) remove old remote
2) add new remote:
remote name: origin
location: same as before, but replace all ":/" or "//" by "/" only
I had the same problem with Xcode 4.6.3.
Here are the steps I performed to resolve the problem:
1. In Xcode I went to File -> Source Control -> Repositories (which opens the Organizer)
2. I then selected the Remotes object from the tree for the Repository I was having the problem with.
3. My remote was named origin, however when expanding it, I noticed it did not have a Branch associated with it.
4. I then selected the remote origin and pressed the Remove Remote option, which removed the remote origin from the view.
5. I then went to a terminal and re-added the remote with:-
`git remote add origin http://username#localhost:7990/scm/iac/main-repository.git`
6. I then needed to add the branch(es) to this remote, which did not worked correctly initially, so I then forced it using the -f command. The command I used was:-
`git push origin master -f`
Note: It may have been possible to skip steps 4 and 5 and just go straight to step 6. I had removed the remote, so did not have the chance to test this.
Note 2: You will need to restart Xcode (or possibly just the Organizer) to see that the remote and branch are now available.
you need first add a remote repository: git remote add yourname https://github.com/user/repo.git
and than push... and xcode find the remote repo and can push too.
I've had the same issue with SSH defined hosts.
My ~/.ssh/config looks like this:
Host myGitServer
HostName {real address goes here}
{Some more config for the host here}
My repository remote URL was in the form of ssh://myGitServer/git/project.git
The problem was that XCode did not read the SSH config to resolve "myGitServer" so the repository was always "offline" for it.
I ended up adding "myGitServer" to /etc/hosts.
I guess that among other things, the "no remotes found" issue is caused when XCode can't directly resolve the name of the GIT remote server.
I had a similar problem where remotes were failing to load, specifically for kiln as the remote host. Looking in the git config for the repository info, the URL had been changed to prepend my email address to it.
So I simply exited Xcode, and then from the command line did:
git remote set-url kiln https://...kiln repo name.git
And that seemed to fix it when I restarted Xcode - both pull & push worked again.
I have no idea why Xcode corrupted the URL. This was with Xcode 4.6.3
1- search and apply the guideline. which is mentioned about "show all hidden files in mac finder". and delete .git directory (this folder wont appear without solving article-1)
2-XCode>Prefences>Accounts>Delete github account and close xcode. than open and reconfigure same github account by adding all over.
3-click the section small icon namely "source control navigation" (which is near the project navigator). as you right click a popup will appear. and choose create blabla on github". actually this steps solved same issue.
Xcode 10.2.1
Double Check:
1) Git Acc under preferences.
2) cmd + 2, right click under remote to create a remote.

Setting up a Git repository on MacOS X with network drive

The given:
A mac with my work folder set up as Git repository.
A network drive (Seagate FreeAgent GoFlex Home, if that helps).
The task:
Set up the specific folder on my network drive as a place where a backup of my repository can be stored.
What I tried:
Setting up the location through Volumes path as a Remote (via Add Remote in Git GUI) - returned with:
fatal: GIT_WORK_TREE (or --work-tree=<directory>) is not allowed without specifying GIT_DIR (or --git-dir=<directory>
Then, I tried
git --git-dir=Volumes/xxxxxxx/GoFlex_Home/Personal/xxxxxxxx
in the terminal, and though it did not turn up with an error, it does not appear to be of result, as another try to add remote ended with the same error as above.
After that, I started to have doubts if specifying the path to network drive through Volumes and/or trying to add it as remote are the right things to do to solve the task. Maybe there are other ways to accomplish the goal that I am not yet aware of?
I assume you get these errors because nothing exist yet in the network share. A remote must point to an existing repository, so you first have to clone it: in the original repo do:
git clone --bare . /Volumes/xxxxxxx/GoFlex_Home/Personal/xxxxxxxx
This will copy your repository data to the network folder.
Then you can add it as a remote:
git remote add --mirror=push backup /Volumes/xxxxxxx/GoFlex_Home/Personal/xxxxxxxx
You will be able to synchronize both with:
git push backup

Resources