Can't push or commit to GitHub in Xcode 9 - ios

I created Git Hub account and clone using SSH
I went to Create Git Repositories. I chose both project folders POD and SFITNESS. Then xCode created the following:
Then I right click on SFITNESS and ADD EXISTING REMOTE which I log in to GitHub to provide the link, everything works fine.
When I went to commit, I choose the SFTNESS folder and commit and at the bottom it allows me to Push to remote which I choose the remote at step 3.
Then it will prompt me for the Username and Password and I can never get the authentication correct. The Username and password is it for Github? I can never get the authentication correct?
Now, at the commit window I have lost my SFITNESS folder, how do I commit again? Is it push now?

Need to Add SSH following this link and use SSH as authenthication.

Related

Cannot clone Git repository into sourcetree, Login screen keeps appearing

In BitBucket, when I select clone into source tree, the URL is of format
Sourcetree opens with details to clone, but keeps asking for my login details no matter how many times I enter them.
https://myname#bitbucket.org/mygroup/myrepository.git
I have no problems on a different computer ( also Windows 10 )
I have tried upgrading SourceTree and Reinstalling Source Tree
I have tried System Git and Embedded Git and reinstalling both Git
I can clone Mercurial repositories
At the Dos prompt I can type
git clone https://myname#bitbucket.org/mygroup/myrepository.git
I get a message
fatal: HttpRequestException encountered
An error occurred wihe sending the request
then it asks for my password
then it proceeds with the clone
However in sourcetree the repository shows that there are more branches to pull.
I am unable to pull these branches
When I go to the Tools->Options->Authentication tab I can see myname#bitbucket.org as an Account.
If I try to add myname#mydomain.com.au I get
Authentication failed
Invalid URL: The hostname could not be parsed.
Atlassian community
"The only thing that worked for me was navigating to C:\Users\USERNAME\AppData\Local\Atlassian\SourceTree and removing the passwd file."
Had the same problem , but on MacOS. Just for completion of the answer I will add that on MacOS the passwords are stored in the KeyChain Access and they need to be deleted from there.

How to clone a Gerrit Code Review repository to a local repository

I have installed Gerrit Code Review. Everything is working fine but in the documentation it is unclear how to clone a repository to local directory.
Using Gerrit admin interface I created a new project. How do I know what URL to use? Does Gerrit support https access to repositories?
Go to Gerrit Web UI
Go to the "Projects > List" menu item
Find your project (use the "Filter" field if needed)
Click on the project name
Go to the "General" tab
See the "git clone" command on the top of the page
Choose if you want to clone via "http" or "ssh"
Copy the "git clone" command clicking on the right icon
Paste/execute the "git clone" command
As it turns out this issue is related to SSH/HTTP/Anonymous HTTP Clone URL not visible in Gerrit 2.12.2
I installed in batch mode without plugins. In that case git clone is not there.

Getting 'Repository does not exist' when pushing from cloud9 toBitbucket

In the book Ruby on Rails Tutorial Micheal Hartl recommends using the Cloud9 https://c9.io cloud IDE. I created a Bitbucket account, set up Git on the IDE, and installed Rails on Cloud9.
git push -u origin --all and getting error message conq: Repository does not exist.
fatal: could not read from remote repository
please make sure you have the correct access rights and the repository exist.
Log into the Bitbucket website and navigate to the dashboard. On the overview tab, you should see a link like 'john_larkin / hello_app'. Click on the link and you will see the Overview page for this repository. At the top right of the page, you will see an SSH select. The name of your repository appears to the right of that select. It should look something like:
git#bitbucket.org:john_larkin/hello-app.git
In your Cloud9 terminal session for the hello app project, issue the command:
git remote add origin <repo>
replacing <repo> with your repository name from Bitbucket.
Once you do this, you should be able to successfully push your code and updates to your repository.
SSH Key
If you are still experiencing issues, make sure you have successfully loaded your SSH key from your Cloud9 IDE into Bitbucket:
Go to https://bitbucket.org/.
Click on your avatar in the upper right hand corner of the page and select 'Manage account'.
Click on the 'SSH Keys' link under Security on the left side panel.
You should see a key listed there - click on the 'edit' link (if you don't see a key, click on the 'Add key' button to add a new key).
On your Cloud9 IDE, click on your avatar at the top of the screen and select 'Dashboard'. Click on 'Show SSH key' on the right of the screen to view your Cloud9 SSH key. This key should match what appears in the Bitbucket edit view. If it does not or you are unsure, you can always delete this key and create a new key by copying your Cloud9 key into Bitbucket.
I got problem to configure C9 and Bitbucket, but after fighting, i win. So, in the first time, for myself i just delete my repo and my app, i was only on the beginning of creation. If its not your case, im not sure, but if you click (upper left) option to show hidden file and delete the .git, that can probably help.
So, i will enumerate my step that make the connection between C9 and Bitbucket working for me.
In C9
git config --global user.name "Your name"
git config --global user.email "email#exemple.com"
git init
git add -A
git commit -m "Creation of my application"
cat ~/.ssh/id_rsa.pub (take all ssh key except email)
In Bitbucket
Add SSH key in Bitbucket Settings
Create Repository
In C9 add Bitbucket code exemple
git remote add origin git#bitbucket.org:(user info)
git remote -v (to see if its correct)
git push -u origin master
At this stage, all should be pushed to Bitbucket
After to push again your code to Bitbucket
git add -A
git commit -m "Your comment here"
git push
Hope that can help some people.
Create a remote repository, in the web site, before pushing it from your local repository.
I had this issue as well. Make sure you added something to the repository with
git add -A
and then
git add -m "Your message"
Then try to push the repository upstream.

Xcode 6.2 won't load remote git repos

I need to keep my Xcode project in 2 remote repos. Below are the steps I took.
Created an empty folder in my Mac.
Added a .gitignore file.
Created a project using Xcode 6.2.
Created a repo on Bitbucket.
Created a repo on Github.
By Selecting Source Control -> Working Copies -> Configure -> Add Remote, I added two remotes.
Then by selecting Xcode Preferences -> Accounts, I filled up the user credentials for each account.
Then I went to commit the initial changes of my project by selecting Source Control -> Commit, it keeps showing Loading remotes... in the remote selection drop down but it wouldn't load.
Am I missing something here? Any steps I missed? I also tried adding them individually to see if it's something with one of the remotes but that didn't work for both of them either.
I opened the git config file on TextEdit and this is what I have there.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "bitbucket"]
url = https://Isuru-Nanayakkara#bitbucket.org/Isuru-Nanayakkara/coolproject.git
fetch = +refs/heads/*:refs/remotes/bitbucket/*
[remote "github"]
url = https://github.com/Isuru-Nanayakkara/CoolProject.git
fetch = +refs/heads/*:refs/remotes/github/*
I was on a detached head (a commit made by another developer) hence there was no matching commit on my branches from my repo. As a result I was getting this:
How I got myself into a detached head? Simply put I did something like git checkout c10847ae6708fadc73d451a68e2dsdf30dbbabd86
Okay, after some fiddling I was able to get it working. Again here are the steps I took.
First I committed my changes locally. I did this through Xcode.
Since the remotes weren't showing in Xcode, I turned to the Terminal's aid. First I pushed to Bitbucket's repo. Initially I tried with git push bitbucket but that would give me an error. Upon searching I found out that I need to set a default remote for my local repo. So I ran the following command and the changes were pushed to the Bitbucket's repo successfully.
git push --set-upstream bitbucket master
Then when I tried to push to the github with git push github, I got this new error ![rejected] master -> master (fetch first). Even after pulling the latest from Bitbucket, I'd still get this error. So in the end to get past this, I ran the following command and force pushed the repo to Github as well.
git push -f github master
After that now I can do my changes in Xcode and push to both remotes from Xcode itself. Now the remotes appear in the drop down! Maybe this is an Xcode bug(?).
Note: If the steps I took are wrong or if there is a cleaner or more right way to go about this, please post your answer. I'm still very much open for suggestions.

Edit project.config in a Gerrit project

I want to add a "verified" label to my Gerrit project to allow Jenkins to verify that the code builds and passes its tests and so on.
I know I need to add a section to project.config as below:
[label "Verified"]
function = MaxWithBlock
value = -1 Fails
value = 0 No score
value = +1 Verified
However, how do I get to that file to edit it?
The project settings are kept in the Git repository for the project. You can edit them by cloning the project from Gerrit, making the change, committing and pushing back to Gerrit.
You can do this for any project, but if you want it to be inherited by all your projects, which you probably do, use All-Projects as the project.
mkdir gtproj
cd gtproj
git init
git remote add origin ssh://<USER>#<GERRITHOST>:29418/<PROJECT>
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config
Then, make the change to the project.config file which will now be in the current directory.
Now, commit the change, and push back to the Gerrit repo:
git commit -a -m "Added label - Verified"
git push origin meta/config:meta/config
And that's it.
If you want to test it: assuming you were actually adding the Verified label, you can check it is working like this. First, make sure the refs/heads/* section of All-Projects (or whichever project you changed above) has Label-Verified -1/+1 set for the relevant groups. This allows the listed groups to verify.
Now, assuming you have a project called MyProject and a patchset reference, say 1,1, to verify:
ssh -p 29418 user#host gerrit review --project MyProject --message "'I just verified this patchset'" --verified +1 1,1
This should return more or less immediately. You should now see in the Gerrit web UI that the user you just logged in as over SSH has left a +1 verified review on that patch.
Credit: Cribbed from this blog post.
You can configure your project config in the Gerrit UI.
You should follow the following steps:
Launch your Gerrit UI.
Login as admin.
Go to projects > and
click List.
Select your project and click Edit config button.
Paste your content and click save.

Resources