Reputation: 11755
I am using Xcode version 12.5 and want to push a demo app to GitHub.
Though I have used GitHub to upload iOS apps in the past; it was a while ago and I needed a mind refresher so I followed these tutorials: How To Use GitHub with Xcode 11 and How to upload Xcode project to GitHub (Working with Git), hoping it would be OK for my use case.
Also taking a look here to review my GitHub knowledge.
But when I try to push my project from Xcode I keep getting this message:
The given URL 'git+ssh://[email protected]:me/MyRepo.git' is invalid.
Provide a valid URL and try again.
although my repository is created. What am I missing?
....... Some more information follows.
Here is what happens when I try a pull:
MacBook-Air$ git pull origin master
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: couldn't find remote ref master
MacBook-Air$
Upvotes: 1
Views: 355
Reputation: 1324258
git+ssh://
might not be correctly interpreted by XCode, while a regular SSH URL ([email protected]:me/myRepo) or HTTPS one would work.
If you are using HHTPS, don't forget to activate git config credential.helper
(you should see osxkeychain
) in order to cache your PAT(Personal Access Token), instead of putting it in clear text in your URL.
Finally, do a git fetch
and see what git status
returns.
And git push
, or, if you are sure your local history is the right one, git push --force
(assuming you are the only one working on that repository).
Another approach (with Git 2.6+, Sep. 2015):
If you care about the remote (GitHub) history, then:
git config --global pull.rebase true
git config --global rebase.autostash true
git pull
That will automatically replay your local commits on top of the updated (fetched) remote tracking branch origin/<yourBranch>
Upvotes: 1